anyone can help me this program :( P L E A S E !!

my friend give me some tips .. the output it should be show all the answer after the quiz then, it will calculate the score of the quiz if he/she pass the quiz


this is the code that my prof. gave..




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<iostream>
#include<fstream>

using namespace std;

main()
{
   ifstream in;
   ofstream out;
   
   string q,a,b,c,d;
   char ans;
   
   
   in.open("Quiz.txt");
   
   getline(in,q);
   in>>a>>b>>c>>d;
   cout<<"1.) "<<q<<" ?"<<"\n\na.) "<<a<<"\tb.) "<<b<<"\nc.) "<<c<<"\td.) "<<d;
   cout<<"\n\nAnswer: ";
   cin>>ans;
   
   


   
      
      
      
      cout<<"\n\n";
      system("PAUSE");
      return 0;
}





==>This is the input of the Quest and Answer


What is the name of American President?
A. Barak
B. Gloria
C. Ninoy
D. Erap







This is the output

  1.)What is the name of American President?

  A. Barak             B. Gloria
  C. Ninoy             D. Erap

  Answer: __
Get a variable for the persons scores which increases with a correct answer.
Display all the corrct answers(a,b,c,d) at the end with their respective question numbers.
Display the final score.

Aceix.
in line 23 insert:
1
2
3
4
if (ans == 'a')
    cout << "Correct: 100%"<< endl;
else
    cout << "Wrong: 0%" << endl;
Topic archived. No new replies allowed.