diff options
author | Michael Abed <michaelabed@gmail.com> | 2012-03-05 14:28:10 -0500 |
---|---|---|
committer | Michael Abed <michaelabed@gmail.com> | 2012-03-05 14:28:10 -0500 |
commit | 1c03e941f1015c48917ddc603d84b134eb705f10 (patch) | |
tree | d89b07d63a12b5542882328c679bb76fb23a5f63 /Q3b.cpp | |
parent | f2566da91396bc07356601794fd5db858a78f1f3 (diff) | |
download | ec327-lab2-master.tar.gz ec327-lab2-master.tar.bz2 ec327-lab2-master.zip |
Diffstat (limited to 'Q3b.cpp')
-rw-r--r-- | Q3b.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -15,15 +15,13 @@ double series(int n) int main(int argc, const char *argv[]) { - int x; - cout << "enter a number to see the sum of the series (0 to quit)" << endl; + long x; + cout << "enter a number to see the sum of the series (negative to quit)" << endl; do { cout << ">> "; cin >> x; - if (x <= 0) - cout << "Please enter a positive number (0 to quit)" << endl; - else + if (x >= 0) cout << "series(" << x << ") = " << series(x) << endl; - } while (x != 0); + } while (x >= 0); return 0; } |