From 1c03e941f1015c48917ddc603d84b134eb705f10 Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Mon, 5 Mar 2012 14:28:10 -0500 Subject: finish it all up --- Q3b.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Q3b.cpp') diff --git a/Q3b.cpp b/Q3b.cpp index 08676c8..55efa7e 100644 --- a/Q3b.cpp +++ b/Q3b.cpp @@ -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; } -- cgit v1.2.3