Please send questions to
st10@humboldt.edu .
// Contract: main: void -> int
//
// Purpose: Ask the user how many times they'd like to see the
// message I LIKE SPAM! written to the screen, and then
// do so.
//
// Examples: If the user enters 3, then printed to the screen will
// be:
// I LIKE SPAM!
// I LIKE SPAM!
// I LIKE SPAM!
//
// by: Sharon Tuttle
// last modified: 11-02-05
#include <iostream>
using namespace std;
int main()
{
int num_times;
// WHERE DO YOU START?
int counter = 0; // very traditional, because of arrays
// (a topic coming up!)
// HOW LONG DO YOU GO?
cout << "How many times would you like to see it? ";
cin >> num_times;
while (counter < num_times) // if start at 0 --- go while counter
{ // is LESS THAN ending limit
cout << "I LIKE SPAM!" << endl; // do the loop action
counter = counter + 1; // go to NEXT counter value
}
return EXIT_SUCCESS;
}