Input ignore

please i just started on C++ 2 weeks back and have got assignments. if i do not declare a variable and need to use cin to declare it and have used the if command to select a range of inputs, how do i get to return back to the cout if the input is not within the range needed.


for example:

#include <iostream>
using namespace std;
#include <string>


int main()
{
string d;
cout<<"what kind of game is it:\t";
cin>> d;
if
{
((d =="boom") || (d == "loom") || (d == "doom") );
}
else
{



}
return 0;
}




if the person puts in a wrong game name, how do i get the input ignored and the cout reprinted
Last edited on
Using a loop: http://www.cplusplus.com/doc/tutorial/control/

The link should provide the necessary info.
Topic archived. No new replies allowed.