hi i want the program below to restart only when specific letter is entered from keyboard....at this point the program accept any letter to restart except 'q'.
so how im gonna do it will only except letter 'r' to restart? thanks.
[tag]
Code:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main (int argc, char *argv[])
{
char again, quit ;
string name = "";
while (quit != 'q')
do{
system ("cls");
cout << "Hello, what is your name? \n";
cin >> name;
cout << "Hi " << name;
cout << "\n Please press r to restart or q to quit and press enter";
cin >> quit;
}
while(toupper(again) == 'r'); //restart program
return 0;
}
[/tag]