topical media & game development

talk show tell print


? / basic-program-solutions-03-Soln3-1B.c

  // Soln3_1B.cpp
  include <iostream>
  using std::cin;
  using std::cout;
  using std::endl;
  int main()
     int val, total=0;
     cout << "Enter numbers, one per line. Enter 0 to end:\n";
        cin >> val;
        total += val;
     } while (val != 0);
     cout << "\nThank you. The total was " << total;
     cout << endl;
     return 0;

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.