Write a program showing how to assign multiple choice answers to a question that is being randomized. ( survey type program therefore no wrong answers)
#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;
}