Hello, i am doing a program for c++. i am making a simple testing program with 20 questions with 4 answers for each question, and when the wrong answer the program has to output the correct answer.At the end of the program it has to count the number of correct answers and give the percentage. ive started writing it but i keep getting errors. pleas can you look at it , give me tips, and tell me whats worng. please and thanks.
//REPS2.cpp
//Morgan Huguelet
#include <iostream.h>
main()
{
int answer;
int i; // counter used by for loop
float A,B,C,D;
char correct;
char ERROR;
cout << "Welcome, this is a test about Spanish.\n";
cout << " \n";
cout << "and I for independents or other parties.\n";
for (i = 1; i <= correct; i++)
{
do
{ // first question
cout << "Question 1: What is the word for 'last year' " << i << ;
cout << " A = Pasado Ano"<<'\n';
cout << " B = Ayer ano"<<'\n';
cout << " C = ayer noche"<<'\n';
cout << " D = rapido noche"<<'\n';
cin >> answer;
switch(answer)
{
case'A':
cout<<"Good job!"<<'/n';
break;
case'B':
cout<<"Incorrect sorry the correct answer was A"<<'/n';
break;
case'C':
cout<<"Incorrect sorry the correct answer was A"<<'/n';
break;
case'D':
cout<<"Incorrect sorry the correct answer was A"<<'/n';
break;
default:
cout << "Invalid entry. Enter A, B , C, or D.\n";
correct = ERROR;
break;
} // end of switch structure
do
{ // 2nd question
cout << "Question 2:How do you say 'I am going to Meijer?' " << i << ;
cout << " A = Vamos soy Meijer. "<<'\n';
cout << " B = Ir Meijer."<<'\n';
cout << " C = Voy a Meijer."<<'\n';
cout << " D = Ir a Meijer."<<'\n';
cin >> answer;
switch(answer)
{
case'A':
cout<<"Incorrect sorry the correct answer was c"<<'/n';
break;
case'B':
cout<<"Incorrect sorry the correct answer was C"<<'/n';
break;
case'C':
cout<<"Good job!"<<'/n';
break;
case'D':
cout<<"Incorrect sorry the correct answer was C"<<'/n';
break;
default:
cout << "Invalid entry. Enter A, B , C, or D.\n";
party = ERROR;
break;
} // end of switch structure
} while (correct == ERROR); // loop again if invalid choice is made
}
cout << "You got " << << " out of 20."
}
system("pause");
return 0;
}
thanks,. so i completed the first loop. and my compiler wont work without the .h in the #include<iostream.h> and i get more errors wit hthe cin.ignor();
and what do you mean with the last part? i understand only 0 is false but i dont get what your reffering to. sorry.
and now im getting a ton of errors.
expected primary-expression before ';' token
expected `;' before '}' token
At global scope: