SOURCE FILE: 030_loopSamp02.cpp


/* 
      This is a program that writes an increasing list of integers,
      starting at one, and increasing by one at each step.  The 
      user tells the program how high to go.
*/

/* ****************************** */

#include <iostream> 
using namespace std ; 

int main (void) 
{
   int lastNum, counter ;

   cout << endl ;
   cout << "This program will  print an increasing sequence of\n" ;
   cout << "positive integers.\n\n" ;

   cout << "Please enter the highest integer to appear\n" ;
   cout << "in the list. It has to be a positive integer. " ;

   cin >> lastNum ;

   if (lastNum <= 0)
      cout << "\nYou entered a bad value.  Try again.\n\n" ;
   
   else 
   {
      counter = 1 ;
      while (counter <= lastNum)
      {
         cout << endl << counter  ;
         counter++ ;
      }
      cout << endl << endl ;
   }

   return 0; 
}

/* ****************************** */