Thread: Making your prgram repeat

  1. #1
    Registered User
    Join Date
    Jul 2005

    Making your prgram repeat

    How do i make any simple or complex program repeat its self like the example program u give us

     #include <iostream>	
    using namespace std;
    int main()                            // Most important part of the program!
      int age;                            // Need a variable...
      cout<<"Please input your age: ";    // Asks for age
      cin>> age;                          // The input is put in age
      cin.ignore();                       // Throw away enter
      if ( age < 100 ) {                  // If the age is less than 100
         cout<<"You are pretty young!\n"; // Just to show you it works...
      else if ( age == 100 ) {            // I use else just to show an example 
         cout<<"You are old\n";           // Just to show you it works...
      else {
        cout<<"You are really old\n";     // Executed if no other statement is
    How do i make it reapeat again at the end so it doesnt close the 2nd time

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    You could use a loop. This site has a tutorial which'll teach you how to use the 3 types of loops in C++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Repeat for part of string
    By bertazoid in forum C Programming
    Replies: 6
    Last Post: 10-26-2008, 05:06 PM
  2. Making great graphics
    By MadCow257 in forum Game Programming
    Replies: 1
    Last Post: 02-20-2006, 11:59 PM
  3. Making an Algorithm repeat itself
    By mvd1212 in forum C Programming
    Replies: 13
    Last Post: 12-02-2005, 07:10 PM
  4. Help with trying to kill repeat function
    By otchster in forum C Programming
    Replies: 13
    Last Post: 10-25-2005, 09:02 PM
  5. About Unix Programming - Making a career desision
    By null in forum C Programming
    Replies: 0
    Last Post: 10-14-2001, 07:37 AM