Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string rightanswers[3] = {"A", "B", "C"};//array declaration
- string user_input;
- string questions[3]= {"What is my name. A) 10R B) Tanji C)Tanmoy", "which School do i go to A) Hunter B)QC C) BARUCH", "What CS class is this A)211 B) 311 C) 111"};//declaring array
- int numRight=0;
- //char question[0] = { "What is my name.\n A) 10R \n B) Tanji \n C)Tanmoy \n" }//assigning questions to array
- //char question[1] = { "which School do i go to \n A) Hunter \n B)QC \n C) BARUCH \n" }//assigning questions
- //char question[2] = { "what CS class is this \n A)211 \n B) 311 \n C) 111 \n" }//assigning questions
- cout<<"For each question, type A, B, or C"<<endl;
- for ( int i=0; i<3; i++)//for loop to show three questions
- {
- cout<<questions[i]<<endl;
- cin >> user_input;
- if(i==0){
- if (user_input==rightanswers[0]);
- numRight++;
- }
- if(i==1){
- if(user_input==rightanswers[1]);
- numRight++;
- }
- if(i==2){
- if(user_input==rightanswers[2]);
- numRight++;
- }
- }
- cout<<"Percentage"<<"="<<numRight/3*100;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement