example1.c --------------------------------------------------- /* a program to print hello world */ #include using namespace std; int main() { cout<<"Hello World" << endl; return 0; } =================================================== example2.c --------------------------------------------------- #include using namespace std; int main() { int x, y; cout << "Enter x = "; cin >> x; cout << "Enter y = "; cin >> y; cout << "x/y=" << x/y << endl; cout << "x%y=" << x%y << endl; return 0; } =================================================== example3.c --------------------------------------------------- #include using namespace std; int main() { int x; cout << "Enter x = "; cin >> x; if(x==0){ cout << "Zero" << endl; } else if(x%2==0){ cout << "Even" << endl; } else cout << "Odd" << endl; return 0; } =================================================== example4.c --------------------------------------------------- #include using namespace std; int main() { char x; cout << "Enter a character: "; cin >> x; switch(x){ case 'A': case 'a': cout << "Excellent" << endl; break; case 'B': case 'b': cout << "Good" << endl; break; case 'C': case 'c': cout << "Average" << endl; break; default: cout << "Enter a,b or c only" << endl; } return 0; } =================================================== example5.c --------------------------------------------------- #include using namespace std; int main() { char x; cout << "Input a character: "; cin >> x; cout << "ASCII code: " << int(x); return 0; } =================================================== example6.c --------------------------------------------------- #include using namespace std; int main() { char x; cout << "Enter a grade: "; cin >> x; if(x>='A'&&x<='Z') cout << "uppercase letter\n"; else if(x>='a'&&x<='z') cout << "lowercase letter\n"; else cout << "not a character\n"; return 0; } ===================================================