1. 7 2. 2 6 21 88 3. float postage (int ounces, int pounds, int costperounce) { ounces = ounces + pounds * 16; return (ounces * costperounce); } 4. float postage(int,int,int); 5. cout << "Enter package weight in pounds and ounces: "; cin >> pounds >> ounces; cout << "Enter mailing cost per ounce: "; cin >> ouncecost; mailcost = postage(ounces,pounds,ouncecost); cout << "The cost to mail this package is: " << mailcost << endl; 6. void checkeven(int num1,int num2,int num3) { if (num1 % 2 == 0 && num2 % 2 == 0 && num3 % 2 == 0) cout << "YES\n"; else cout << "NO\n"; } 7. void checkeven(int,int,int); 8. cout << "Enter three numbers: "; cin >> n1 >> n2 >> n3; checkeven(n1,n2,n3); 9. int checkeven(int num1,int num2,int num3) { if (num1 % 2 == 0 && num2 % 2 == 0 && num3 % 2 == 0) return 1; else return 0; } 10. int checkeven(int,int,int); 11. cout << "Enter three numbers: "; cin >> n1 >> n2 >> n3; result = checkeven(n1,n2,n3); if (result) // same as if (result == 1) cout << "YES\n"; else cout << "NO\n";
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2002