This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() { | |
| auto lambda = [] { cout << "hello world from lambda1!" << endl; }; | |
| lambda(); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DivideByZeroException : public exception | |
| { | |
| public: | |
| DivideByZeroException() : | |
| exception("") | |
| { | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void A(); | |
| void B() | |
| throw (out_of_range, invalid_argument); | |
| void C() | |
| throw(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void willRethrow() { | |
| try { | |
| willThrowException(); | |
| } catch (...) { | |
| cout << "caught an exception! " << endl; | |
| throw; | |
| } | |
| cout << "Never executed!"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| void willThrowException(){ | |
| throw 42; | |
| } | |
| void willRethrow() { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| int main() { | |
| vector<int> values; | |
| int value; | |
| cout << "enter a integer value list (^Z to complete): "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <library_geometries> | |
| <geometry id=”geom-Sphere01″ name=”Sphere01″> | |
| </geometry> | |
| <geometry id=”geom-Sphere02″ name=”Sphere02″> | |
| </geometry> | |
| </library_geometries> |