diff options
Diffstat (limited to '')
-rw-r--r-- | ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp | 2 | ||||
-rw-r--r-- | misc/test.cpp | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp b/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp index 2476b31..f0689d4 100644 --- a/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp +++ b/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp @@ -14,7 +14,7 @@ using namespace std; int main () { int Dependents, Hours; - int OT = 0; int Health = 0; int Union =0; //Set values to zero to prevent problems + int OT = 0, Health = 0, Union =0; //Set values to zero to prevent problems double SocSec, State, Fed, GrossPay, NetPay; cout << "How many hours did you work this week?: "; cin >> Hours; diff --git a/misc/test.cpp b/misc/test.cpp index 40e15c5..109925d 100644 --- a/misc/test.cpp +++ b/misc/test.cpp @@ -7,16 +7,17 @@ int main () { cout << "Enter a number:"; cin >> x; for (i=x; i>1; --i) - { if (x%i==0 && x!=i) { - cout << "Not prime!" << endl; + cout << x << " is not prime!" << endl; + cout << "Divisible by " << i << "." << endl << endl; a=1; break; - return i; } + } } - if (!a) - cout << "Prime!" << endl; + if (!a){ + cout << x << " is a prime number!" << endl << endl; return 0; -} + } +}
\ No newline at end of file |