#include // for cout and cin #include // for getch() #include // for pow() using namespace std; // for cout and cin int main() { /* * Wages Calculator */ cout << "Wages Calculator" << endl; double regularWages, basePayRate = 18.25, regularHours = 40.0, overtimeWages, overtimePayRate = 27.78, overtimeHours = 10, totalWages; regularWages = basePayRate * regularHours; overtimeWages = overtimePayRate * overtimeHours; totalWages = regularWages + overtimeWages; cout << endl << "Total Wages: $" << totalWages << endl; getch(); /* * Volume of Cylinder */ cout << endl << "Volume of Cylinder" << endl; const double PI = 3.14159; double radius = 12.34; double height = 23.45; double volume = PI * pow( radius, 2) * height; cout << "Volume: " << volume << endl; getch(); /* * Integer and Floating Point Division */ cout << endl << "Integer and Floating Point Division" << endl; double fraction = 5 / 2; cout << "fraction: " << fraction << endl; fraction = 5 / 2.0; cout << "fraction: " << fraction << endl; getch(); /* * Average Calculator */ cout << endl << "Average Calculator" << endl; cout << "Enter 3 test scores:" << endl; int score1, score2, score3, average; cin >> score1 >> score2 >> score3; average = ( score1 + score2 + score3 ) / 3.0; cout << "Average: " << average << endl; getch(); /* * Increment / Decrement */ cout << endl << "Increment / Decrement" << endl; int x, y; x = 1; cout << "x = " << x << endl; y = ++x; // x is now 2, y is also 2 cout << "x = " << x << ", y = " << y << endl; y = x++; // x is now 3, y is 2 cout << "x = " << x << ", y = " << y << endl; x = 3; y = x--; // x is now 2, y is 3 cout << "x = " << x << ", y = " << y << endl; y = --x; // x is now 1, y is also 1 cout << "x = " << x << ", y = " << y << endl; getch(); /* * Pythagoras */ cout << endl << "Pythagoras" << endl; cout << "Enter sides:" << endl; double a, b, c; cin >> a >> b; c = sqrt ( pow ( a, 2 ) + pow ( b, 2 ) ); cout << "Hypotenuse: " << c << endl; getch(); }