#include #include using namespace std; int main() { int a=0,b=109,e=0; char c; c = 'm'; int myInt = 10; float myFloat = 23.3; double myDouble = 16.9; cout << myInt << endl; myInt = (int) myFloat; cout << myInt << endl; myInt = (int) myDouble; myDouble = (double) myInt; myFloat = (float) myDouble; string s = "hello world"; cout << "s is: " << s << endl; if (c = (char) b) // does an assignment, not equality { cout <<"C is " << c << endl; } else { cout << "B is not 1" << endl; } if ((a = 1) & (a > 0)) { cout << "a is larger than 0"; } // ands, ors and nots int myNum = 50; if (myNum < 54 > 0 & myNum > 1 & myNum >2) { cout < 5) { cout << "True" << endl; } else { cout << "NOT True" << endl; } // loops repeatedly - endless loop // do { // cout << "I'm repeating execution" << endl; // } while (true); // controlled loop - do example int counter = 0; // do { // cout << "Enter a number: "; // cin >> myInt; // cout << myInt << endl; // counter++; // } while (counter < 5); // while example while (counter <= 5) { cout << counter << endl; counter++; } // counter controlled structure for (counter=0; counter<=5; counter++ ) { cout << "Counter is: " << counter << endl; } // Simple Menu int selected = 0; do { cout << endl << "Press 1 for... " << endl; cout << "Press 2 for..." << endl; cout << "Press 3 to exit" << endl; cin >> selected; cout << "You selected option " << selected << endl; if (selected == 3) { exit(0); } } while (true); return 0; }