Skip to content

Instantly share code, notes, and snippets.

View ElemarJR's full-sized avatar
🏠
Working from home

Elemar Rodrigues Severo Junior ElemarJR

🏠
Working from home
View GitHub Profile
#include <iostream>
using namespace std;
int main() {
auto add = [](int a, int b) -> int { return a + b; };
cout << "add(5, 2) = " << add(5,2) << endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
auto add = [](int a, int b) { return a + b; };
cout << "add(5, 2) = " << add(5,2) << endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
auto lambda = [] { cout << "hello world from lambda1!" << endl; };
lambda();
return 0;
}
class DivideByZeroException : public exception
{
public:
DivideByZeroException() :
exception("")
{
}
};
void A();
void B()
throw (out_of_range, invalid_argument);
void C()
throw();
void willRethrow() {
try {
willThrowException();
} catch (...) {
cout << "caught an exception! " << endl;
throw;
}
cout << "Never executed!";
}
#include <iostream>
using namespace std;
void willThrowException(){
throw 42;
}
void willRethrow() {
try {
#include <iostream>
#include <stdexcept>
using namespace std;
int safeDivide(int a, int b) {
if (b == 0)
throw invalid_argument("Division by 0");
return a / b;
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> values;
int value;
cout << "enter a integer value list (^Z to complete): ";
<library_geometries>
<geometry id=”geom-Sphere01″ name=”Sphere01″>
</geometry>
<geometry id=”geom-Sphere02″ name=”Sphere02″>
</geometry>
</library_geometries>