Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3029

code stuck at getline...

$
0
0
my code is not moving past the line below...actually i am making a quiz and this piece of code id checking whether the entered answer is correct, from a file.
please tell me the possible reason for the problem..
Code:

getline(anss,saveans);
Code:

while(a<1)
                        {
                                getline(anss,saveans);
                                if (saveans == ToString(randNum))
                                {
                                        getline(anss,saveans);
                                        if (saveans == ans)
                                        {
                                                cout<<"correct!"<<endl;
                                                cout<<"# next question # "<<endl;
                                        }
                                        else
                                        {
                                                cout<<"wrong answer!"<<endl; // Prints our STRING
                                                cout<<"# next question # "<<endl;
                                        }
                                                break;
                                }
                        }


Viewing all articles
Browse latest Browse all 3029

Latest Images

Trending Articles



Latest Images