|
From: Noorez K. <coo...@ho...> - 2004-08-13 02:11:32
|
At the marked lines, the of one thing is shown on the next input as if i
typed it. I can use the backspace key to get rid of it but it's very
annoying.
#ifndef quiz_h
#define quiz_h
class Quiz
{
private:
char question[1000];
char answerA[1000];
char answerB[1000];
char answerC[1000];
char answerD[1000];
char answerT;
char answerF;
char actual;
public:
static int questionNumb;
static int type;
Quiz createQuestion();
void writeQuestion(Quiz ques, int type,char* quizName);
};
#endif
Quiz Quiz::createQuestion()
{
Quiz ques;
cls();
cout << "What kind of question do you want question " <<
Quiz::questionNumb
<< " to be\n";
real1:
cout << "A. Multiple choice or B. True/False [a\\b] ";
char choice;
choice=getche(); //the choice hear
if(!(choice == 'a' || choice == 'b'))
{
cout << "\nChoice must be a or b\n";
goto real1;
}
if(choice == 'a' || choice == 'A')
{
type = 1;
cout << "\n\nType the question in\n\n"; //is shown after this
statment
cin.getline(ques.question,1000);
cout << "Type in answer A. ";
cin.getline(ques.answerA,1000);
cout << "Type in answer B. ";
cin.getline(ques.answerB,1000);
cout << "Type in answer C. ";
cin.getline(ques.answerC,1000);
cout << "Type in answer D. ";
cin.getline(ques.answerD,1000);
real2:
cout << "Give us the real answer [a\\b\\c\\d] ";
ques.actual=getche();
if(!(ques.actual == 'a' || ques.actual == 'b'
|| ques.actual == 'c' || ques.actual == 'd') )
{
cout << "\nReal answer must be a,b,c or d\n";
goto real2;
}
}
if(choice == 'b' || choice == 'B')
{
type = 2;
cout << "\n\nType in the statement\n\n";//of after this one
cin.getline(ques.question,1000);
real3:
cout << "Give us the real answer [t\\f] ";
ques.actual=getche();
if(!(ques.actual == 't' || ques.actual == 'f'))
{
cout << "\nReal answer must be t or f\n";
goto real3;
}
}
return ques;
}
_________________________________________________________________
Take charge with a pop-up guard built on patented Microsoft® SmartScreen
Technology
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN® Premium right now and get the
first two months FREE*.
|