Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a c++ code for the following game that compiles in visual studio 2010 expr

ID: 3540090 • Letter: W

Question

write a c++ code for the following game that compiles in visual studio 2010 express.

It is a question answer game that asks player altogether of 20 question. Two catagories of questions are offered in the screen and user selects one. lets say two catagories be:

1.History, Science, Computer science

2.Politics, General Knowlwdge, Computer Science

now player selects one catagory and game begins.

format of question is at the bottom.

Final rule: if player answers worng cout<<"you loose" and game ends directly. if answer is right question jumps to next question.

use getline to get all the spaces of answer.You can use any selection structure to select catagories.





This is the format of the question of selection 1.History, Science, Computer science***************please use the exact same question

for the selection 2.Politics, General Knowlwdge, Computer Science just writeup any 1 question you like, and i ll do the rest.



cout<< "1. Who is the current president of United states?"

<<"hint: b_r_k _b_ _ _" <<endl;


getline(cin,ans);

if(ans=="barak obama")

cout<<"good job! 10 pionts!!";



cout << "2. How many mooons does saturn have?"

<< "hint: _i_t_" <;>


getline


if(ans2=="sixty")

{

cout << "good job! 20 pionts!!";

}


else

cout << "Sorry you loose!";


cout << "3. Who is known as the father of computer?"

<< "hint: c_ _r_ _ b_ _ _ _ _ e" <;>


getline


if(ans3=="charles babbage")

{

cout << "good job! 30 pionts!!";

}


else

cout << "Sorry you loose!";



cout << "4. How many rings are there on olympic flag?"

<< "hint: _i_e;"<;>


getline


if(ans4=="five")

{

cout << "good job! 40 pionts!!";

}


else

cout << "Sorry you loose!";



cout << "5. Which company is owned by Bill Gates?"

<< "hint: m_ _ _ o_ _ _ t" <;>


getline

if(ans5=="microsoft")

{

cout << "good job! 50 pionts!!";

}


else

cout << "Sorry you loose!";





cout << "6. On which peninsuladid the Mayan civilization arise?"

<<"hint: y_ _ a_ _n" <<endl;


getline

if(ans6=="yucatan")

{

cout << "good job! 60 pionts!!";

}


else

cout << "Sorry you loose!";




cout << "7. What language does the computer use and understand?"

<< "hint: m_ _ h_ _ e" <<endl;


getline

if(ans7=="machine")

{

cout << "good job! 70 pionts!!";

}


else

cout << "Sorry you loose!";



cout << "8.What cable connects a cable modem to a wireless router?"

<< "hint: c_ _5" <<endl;


getline

if(ans8=="cat5")

{

cout << "good job! 80 pionts!!";

}


else

cout << "Sorry you loose!";




cout << "9. How many bits are there in megabit? (type in numbers)"

<< "hint: 1_ _0_ _0" <<endl;


getline

if(ans9=="10000")

{

cout << "good job! 90 pionts!!";

}


else

cout << "Sorry you loose!";


cout << "10. Which word best describes the colonist refusal to impact British goods?"

<< "hint: b_ _c_t" <<endl;

getline

if(ans10=="boycot")

{

cout << "good job! 100 pionts!!";

}


else

cout << "Sorry you loose!";



cout << "11. What is the first name of the Rambo character created by Sylvester Stallone?"

<< "hint: j_ _n" <<endl;


getline

if(ans11=="john")

{

cout << "good job! 110 pionts!!";

}


else

cout << "Sorry you loose!";




cout << "12. What galaxy does the earth lie in?"

<< "hint: m_ _ _y _a_" <<endl;


getline

if(ans12=="milkyway")

{

cout << "good job! 120 pionts!!";

}


else cout << "Sorry you loose!";




cout << "13.Solar power generates electricity from what source?"

<< "hint: T_e _u_" <<endl;

getline

if(ans13=="the sun")

{

cout << "good job! 130 pionts!!";

}


else cout << "Sorry you loose!";



cout << "14.The input device that is most likely to be used to play computer game is the.."

<< "hint: J_ _s_ _ _k" <<endl;


getline

if(ans14=="joystick")

{

cout << "good job! 430 pionts!!";

}


else cout << "Sorry you loose!";




cout << "15.Through which national park does the continental divide not pass?"


<< "hint: y_ _ e_ _ _e" <<endl;


getline

if(ans15=="yosemite")

{

cout << "good job! 150 pionts!!";

}


else cout << "Sorry you loose!";



cout << "16.hich planet is recently excluded from our solar system?"

<< "hint: p_ _ _o"<<endl;


getline

if(ans16=="pluto")

{

cout << "good job! 160 pionts!!";

}


else cout << "Sorry you loose!";




cout << "17.Windows is an.."

<< "hint: o_ _ r_ _ _ _g _ _ s_ _m" <<endl;



getline

if(ans17=="operating ststem")

{

cout << "good job! 170 pionts!!";

}


else cout << "Sorry you loose!";



cout << "18. In what American state would you find Mount Mckinley?"

<< "hint: a_ _s_a"<<endl;


getline

if(ans18=="alaska")

{

cout << "good job! 180 pionts!!";

}


else cout << "Sorry you loose!";



cout << "19. A number with a base of 8 is refered as?"

<< "hint: o_t_l"<<endl;

getline

if(ans19=="octal")

{

cout << "good job! 190 pionts!!";

}


else cout << "Sorry you loose!";



cout << "20. Ram is_____________ memory."

<< "hint: v_ _a_ _ _e" <<endl;

getline

if(ans20=="volatile")

{

cout << "good job! 200 pionts!!";

}


else cout << "Sorry you loose!";

system("pause");

return 0;


}











Explanation / Answer

#include <iostream>
#include<string>
using namespace std;

int main()
{
int sel=0;
while(sel!=1 && sel!=2)
{
    cout<< "select 1 for 1.History, Science, Computer science" << endl;
    cout<< "select 2 for   2.Politics, General Knowlwdge, Computer Science" << endl;
    cin >> sel;
    if(sel!=1 && sel!=2)
        cout << " Invalid selection. select again" << endl;
}
string ans;
getline(cin,ans);
if(sel == 1)
{
cout<< "1. Who is the current president of United states? " <<"hint: b_r_k   _b_ _ _" <<endl;
getline(cin,ans);
if(ans.compare("barak obama")==0)
cout<<"good job! 10 pionts!!" << endl;
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "2. How many mooons does saturn have?" << "hint: _i_t_" << endl;
getline(cin,ans);
if(ans.compare("sixty")==0)
{
cout << "good job! 20 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "3. Who is known as the father of computer?" << "hint: c_ _r_ _   b_ _ _ _ _ e" << endl;
getline(cin,ans);
if(ans.compare("charles babbage")==0)

{
cout << "good job! 30 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "4. How many rings are there on olympic flag?" << "hint: _i_e;"<< endl;
getline(cin,ans);
if(ans.compare("five")==0)
{
cout << "good job! 40 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "5. Which company is owned by Bill Gates?" << "hint: m_ _ _ o_ _ _ t" << endl;
getline(cin,ans);
if(ans.compare("microsoft")==0)
{
cout << "good job! 50 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "6. On which peninsuladid the Mayan civilization arise?" <<"hint: y_ _ a_ _n" <<endl;
getline(cin,ans);
if(ans.compare("yucatan")==0)
{
cout << "good job! 60 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "7. What language does the computer use and understand?" << "hint: m_ _ h_ _ e" <<endl;
getline(cin,ans);
if(ans.compare("machine")==0)
{
cout << "good job! 70 pionts!!" << endl;
}
else
{
    cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "8.What cable connects a cable modem to a wireless router?" << "hint: c_ _5" <<endl;
getline(cin,ans);
if(ans.compare("cat5")==0)
{
cout << "good job! 80 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "9. How many bits are there in megabit? (type in numbers)" << "hint: 1_ _0_ _0" <<endl;
getline(cin,ans);
if(ans.compare("10000")==0)
{
cout << "good job! 90 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "10. Which word best describes the colonist refusal to impact British goods?" << "hint: b_ _c_t" <<endl;
getline(cin,ans);
if(ans.compare("boycot")==0)
{
cout << "good job! 100 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "11. What is the first name of the Rambo character created by Sylvester Stallone?" << "hint: j_ _n" <<endl;
getline(cin,ans);
if(ans.compare("john")==0)
{
cout << "good job! 110 pionts!!" << endl;
}
else
{
cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "12. What galaxy does the earth lie in?" << "hint: m_ _ _y _a_" <<endl;
getline(cin,ans);
if(ans.compare("milkyway")==0)
{
cout << "good job! 120 pionts!!" << endl;
}
else
{
    cout << "Sorry you loose!"; system("pause");
return 0;
}
cout << "13.Solar power generates electricity from what source?" << "hint: T_e _u_" <<endl;
getline(cin,ans);
if(ans.compare("the sun")==0)
{
cout << "good job! 130 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
cout << "14.The input device that is most likely to be used to play computer game is the.." << "hint: J_ _s_ _ _k" <<endl;
getline(cin,ans);
if(ans.compare("joystick")==0)
{
cout << "good job! 430 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
cout << "15.Through which national park does the continental divide not pass?" << "hint: y_ _ e_ _ _e" <<endl;
getline(cin,ans);
if(ans.compare("yosemite")==0)
{
cout << "good job! 150 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
cout << "16.hich planet is recently excluded from our solar system?" << "hint: p_ _ _o"<<endl;
getline(cin,ans);
if(ans.compare("pluto")==0)
{
cout << "good job! 160 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
cout << "17.Windows is an.." << "hint: o_ _ r_ _ _ _g _ _ s_ _m" <<endl;
getline(cin,ans);
if(ans.compare("operating ststem")==0)
{
cout << "good job! 170 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
cout << "18. In what American state would you find Mount Mckinley?" << "hint: a_ _s_a"<<endl;
getline(cin,ans);
if(ans.compare("alaska")==0)
{
cout << "good job! 180 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
cout << "19. A number with a base of 8 is refered as?" << "hint: o_t_l"<<endl;
getline(cin,ans);
if(ans.compare("octal")==0)
{
cout << "good job! 190 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
cout << "20. Ram is_____________ memory."<< "hint: v_ _a_ _ _e" <<endl;
getline(cin,ans);
if(ans.compare("volatile")==0)
{
cout << "good job! 200 pionts!!" << endl;
}
else { cout << "Sorry you loose!"; system("pause"); return 0; }
}
else if(sel==2)
{
// this is the block for remaining 20 questions..
    // you have not posted them.
    // post them for here to execute.
    //
    cout << " need 20 more questions to ask " << endl;
}

system("pause");
return 0;
}