#include // from math import sin // x = sin(27); // import math // x = math.sin(27); // Before this: // std::cout << "hi\n"; using namespace std; // After this: // cout << "hi\n"; /* return_type function_name(function_parameters){ return something that's our return type } */ int add_5(int x){ return x -1; } /* Python: def add_5(x): return x + 5 */ int main(){ cout << "This is a mess!\n"; int a = add_5(2); cout << a << "\n"; if(a > 3){ cout << "Our function worked!\n"; cout << "Second line of our function\n"; } int i = 1; while(i <= 10) { cout << i*i << " "; i++; } cout << "\n"; // Or you can say: cout << endl; // A C-style "for" loop for(int j = 1; j <= 10; j++) cout << j*j << " "; // j is out of scope at this point and no longer exists // i is still in scope from the "while" loop above cout << "\n"; int numbers[] = {2, 4, 6, 8, 10}; for(int n : numbers) cout << n << " "; cout << "\n"; return 0; }