1. cout <<"Enter a character: "; cin >> ch; if (ch >= 'A' && ch <= 'Z') cout << ch << " is an uppercase letter\n"; else if (ch >= 'a' && ch <= 'z') cout << ch << " is a lowercase letter\n"; else if (ch >= '0' && ch <= '9') cout << ch << " is a digit\n"; else cout << ch << " is a special character\n"; 2. cout << "Enter the speed limit: "; cin >> splimit; cout << "Enter the actual speed: "; cin >> actspeed; overlimit = actspeed - splimit; if (overlimit >= 1 && overlimit <=14) fine = 75; else if (overlimit <=24) fine = 125; else fine = 215; cout << "The fine for travelling " << overlimit << "miles over the speed limit is " << fine << endl;
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2002