problem looping

#include <iostream>
# include <string>
#include <iomanip>
using namespace std;
int q, w, yes;
int* ptrq;
int *ptrw;
string answer;
void AskForTwoNumbers(int * ptrq, int * ptrw);
void TheBigOne(string q, int w);
int main ()
{
do
{
int q,w;
AskForTwoNumbers(&q, &w);
cout << " \n Do another number? yes/no";
cin >> yes;
getline(cin,answer);

}while(answer == "yes");


}
void AskForTwoNumbers(int * ptrq, int * ptrw)
{
cout << "enter one number";
cin >> *ptrq;
cout << "enter another number";
cin >> *ptrw;
if (*ptrq>*ptrw){

cout << *ptrq << "this is the big one";
}
else if(*ptrw>*ptrq) {

cout << *ptrw << "this is the big one";
}
else {

cout << * ptrq << "this is not the big one";
}

}











I can't figure out my get line the program just quits
getline only waits for the user to input if there isn't currently stuff in the stream, in your case, there in a new line remaining. I would put cin.sync() before the getline to clear it.
Topic archived. No new replies allowed.