lesson 9 askcount cpp
[[lesson_9_askcount_cpp]] last edit on Aug 10, 2005 3:44 AM by rescued_by_c

[user02@FC4 Lesson09]$ cat -n askcount.cpp
   1  #include <iostream>
   2  using namespace std;
   3
   4  int main()
   5  {
   6     int count;
   7     int ending_value;
   8
   9     cout << "Type in the ending value and press Enter: ";
  10     cin >> ending_value;
  11
  12     for (count = 0; count <= ending_value; count++)
  13        cout << count << ' ';
  14     cout << endl;
  15
  16     return 0;
  17  }
[user02@FC4 Lesson09]$ g++ -o askcount askcount.cpp
[user02@FC4 Lesson09]$ ./askcount
Type in the ending value and press Enter: 20
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20