Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

problem infinite loop in my program

$
0
0
Can some help me with my problem when ever I try to end the loop it always go to infinite loop see my source code

/*Max Integer
*x
*/

#include <iostream>
#include <conio.h>
#include <stdlib.h>
using namespace std;

int main()
{
    //declaration of variables
    int num;
    int counter = 1;
    int largest = 0;
    char quit;
    
    while (quit != 'n' && quit != 'N')
    {
          cout <<" Enter An Integer: ";
          cin >> num;
          
          if (num > largest)
          {
                  largest = num;
                  }//end if
          system ("cls");
          cout <<"The largest Integer is: " << largest << endl;
    }//end while
    
    getch();
    return 0;
}//end program


Viewing all articles
Browse latest Browse all 51036

Trending Articles