Write a program showing how to assign multiple choice answers to a question that is being randomized. ( survey type program therefore no wrong answers)
1
Expert's answer
2013-05-21T08:06:12-0400
#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; }
Comments
Leave a comment