basically if i ask for an string i.e. i ask someone a question cout<< "is this correct yes or no?"; cin >> a; and then a number is input the program just goes crazy how do i solve this??

You need to be a little more clear in what your asking. I can understand very little of what you have said.

Have you included the string library?

What is "a" defined as ?

if you had something like this , and the user entered a number instead of "yes" or "no" , the string class would just store the value entered as a string, and you could check it.

string yorn;
bool   done = false;

  while (!done){
      cout << "enter yes or no " << endl;
      cin  >> yorn; 
      if (yorn != "yes" && yorn != "no"){
        cout << "wrong input " << endl;
        continue;
      }
      else
        done = true;
   }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.