Code:
//Program Name: ngquiz.cpp//
//Revision Date: 2002-09-08//
//Explanation: using variables and strings, create a quizzer program that will display a remedial quizzer similar to the one used school//
#include<iostream.h>
#include<conio.h>
#include<time.h>
#include<string.h>
#include<math.h>
char copy1[80],copy2[80], copy3[80] ,last[80], first[80], teacher[80], question1[80], question2[80], answer2[80], real2[80], question3[80], answer3[80], real3[80], check1[10], check2[10], check3[10],answer1[80], real1[80];
int count, grade, goal, correct1, correct2, correct3, totalcorrect, average;
main()
{
textattr(18);
count = 0;
time_t t=time(NULL);
strcpy(question1,"What is the total line to clear the screen?");
strcpy(real1,"clrscr();");
strcpy(question2,"What library is needed to use the command to clear the screen?");
strcpy(real2,"conio.h");
strcpy(question3,"What command is used to display characters on the screen?");
strcpy(real3,"cout");
cout<<" Quizzer Program for C++"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
cout<<"What is your surname?: ";
cin>>last;
cout<<"What is your given name?: ";
cin>>first;
cout<<"What is your teacher's name?: ";
cin>>teacher;
cout<<"What grade are you in?: ";
cin>>grade;
cout<<"What is your goal?(0-3): ";
cin>>goal;
cout<<endl;
cout<<"Press Spacebar to Continue..."<<endl;
getch();
do
{
count= count +1;
if (count == 1)
{
clrscr();
cout<<ctime(&t)<<endl<<endl;
cout<<" C++ Quizzer"<<endl;
cout<<" ~~~~~~~~~~~"<<endl<<endl;
cout<<"Question 1: "<<endl;
cout<<" "<<question1<<endl<<endl;
cout<<endl;
cout<<endl;
cin>>answer1;
cout<<endl;
cout<<"Press The Spacebar To Continue..."<<endl;
getch();
clrscr();
cout<<ctime(&t)<<endl<<endl;
cout<<" C++ Quizzer"<<endl;
cout<<" ~~~~~~~~~~~"<<endl<<endl;
cout<<"Your answer: "<<answer1<<endl;
cout<<"The Correct Answer: "<<real1<<endl;
getch();
}
if (count == 2)
{
clrscr();
cout<<ctime(&t)<<endl<<endl;
cout<<" C++ Quizzer"<<endl;
cout<<" ~~~~~~~~~~~"<<endl<<endl;
cout<<"Question 2: "<<endl;
cout<<question2<<endl<<endl;
cout<<endl;
cout<<endl;
cin>>answer2;
cout<<"Press The Spacebar To Continue..."<<endl;
getch();
clrscr();
cout<<ctime(&t)<<endl<<endl;
cout<<" C++ Quizzer"<<endl;
cout<<" ~~~~~~~~~~~"<<endl<<endl;
cout<<"Your answer: "<<answer2<<endl;
cout<<"The Correct Answer: "<<real2<<endl;
getch();
}
if (count == 3)
{
clrscr();
cout<<ctime(&t)<<endl<<endl;
cout<<" C++ Quizzer"<<endl;
cout<<" ~~~~~~~~~~~"<<endl<<endl;
cout<<"Question 3: "<<endl;
cout<<" "<<question3<<endl<<endl;
cout<<endl;
cout<<endl;
cin>>answer3;
cout<<"Press The Spacebar To Continue..."<<endl;
getch();
clrscr();
cout<<ctime(&t)<<endl<<endl;
cout<<" C++ Quizzer"<<endl;
cout<<" ~~~~~~~~~~~"<<endl<<endl;
cout<<"Your answer: "<<answer3<<endl;
cout<<"The Correct Answer: "<<real3<<endl;
getch();
}
}
while (count<=3);
cout<<answer1<<endl;
cout<<answer2<<endl;
cout<<answer3<<endl;
getch();
clrscr();
if ( answer1 == real1)
correct1 == 1;
else
correct1 == 0;
if (answer2 == real2)
{
correct2=1;
}
else
{
correct2=0;
}
if (answer3==real3)
{
correct3=1;
}
else
{
correct3=0;
}
cout<<" "<<ctime(&t)<<endl;
cout<<" C++ Quizzer Summary"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
cout<<"Summary For: "<<last<<", "<<first<<endl;
cout<<"Teacher: "<<teacher<<endl;
cout<<"Grade: "<<grade<<endl;
cout<<"Goal: "<<goal<<endl;
cout<<endl;
cout<<"Question 1- Your Answer: "<<answer1<<endl;
cout<<endl;
cout<<"Question 2- Your Answer: "<<answer2<<endl;
cout<<endl;
cout<<"Question 3- Your Answer: "<<answer3<<endl;
cout<<endl;
totalcorrect= correct1 + correct2 + correct3;
cout<<"Questions Answered Correctly: "<<totalcorrect<<endl;
if (totalcorrect==0)
{
average=(0/3)*100;
}
if (totalcorrect==1)
{
average=(1/3)*100;
}
if (totalcorrect==2)
{
average=(2/3)*100;
}
if (totalcorrect==3)
{
average=(3/3)*100;
}
cout<<endl;
cout<<"Your Average is: "<<average<<"%"<<endl;
getch();
clrscr();
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<" Happy Test Typing!!!"<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
}
that is my whole program, i just need some help with the loops