60 519
Assignments Done
98,2%
Successfully Done
In April 2018

Answer to Question #30846 in C++ for Sarah

Question #30846
Write a program showing how to assign multiple choice answers to a question that is being randomized. ( survey type program therefore no wrong answers)
Expert's answer
#include <iostream>#include <stdlib>
using namespace;
int number, answer;
int main()
{
number=rand()%3+1;
if (number==1){
cout<<"What the capital of GB? 1. London, 2. Berlin, 3.Amsterdam"<<endl;
cin>>answer;
if(answer==1) cout<<"True";
elsecout<<"False";
}
else if(number==2){
cout<<"What the capital of Germany? 1. London, 2. Berlin, 3.Amsterdam"<<endl;
cin>>answer;
if(answer==2) cout<<"True";
elsecout<<"False";
}
else if(number==1){
cout<<"What the capital of USA? 1. Washington, 2. Berlin, 3.Amsterdam"<<endl;
cin>>answer;
if(answer==1) cout<<"True";
elsecout<<"False";
}
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions