I need to make multiple choice and a switch statement is used to check for correct answers. Also introduce a random element whereby the user can roll a dice and skip the following question if he gets a 6 (other rewards/penalties can be introduced for different dice values).

this is what iv done so far

#include<iostream>
#include<string>
#include"110ct.h"

using namespace std;

int main()
{
string s, a, b, c, d, e;
CursorController crs;
ColourController cl;
int counter =0;
cout << "Welcome to the multiple choice quiz!." << endl;
cout << "Are You Ready? (y/n)" << endl;
cin >> s;
if(s == "y")
{
cout << "Question 1: What is 7 + 100? \n";
cout << "A: 174 \n";
cout << "B: 107 \n";
cout << "C: 1586 \n";
cout << "D: 12 \n";
cin >> a;
}
if(a == "b" || a == "B")
{
cl.setForeground(Blue);
cout << "Congratulations! You earned 1 point. \n";
counter ++;
}
else
{
cl.setForeground(Yellow);
cout << "I'm sorry, that is incorrect. The correct answer was B: 16 \n";
}
cl.setForeground(White);
cout << "Press any key to continue" << endl;
qin.get();
crs.clearAll();
cout << "Question 2: What language do they speak Italy? \n";
cout << "A: Whats a language? \n";
cout << "B: They don't know how to talk. \n";
cout << "C: Spanish \n";
cout << "D: Italian \n";
cin >> b;
if(b == "d" || b == "D")
{
cl.setForeground(Blue);
cout << "Congratulations! 1 point. \n";
counter ++;
{
cout << "Question 1: What is 7 + 100? \n";
cout << "A: 174 \n";
cout << "B: 107 \n";
cout << "C: 1586 \n";
cout << "D: 12 \n";
cin >> a;
}
if(a == "b" || a == "B")
{
cl.setForeground(Blue);
cout << "Congratulations! You earned 1 point. \n";
counter ++;
}
else
{
cl.setForeground(Yellow);
cout << "I'm sorry, that is incorrect. The correct answer was B: 16 \n";
}
return 0;

}

}

Recommended Answers

All 4 Replies

you seem to be doing fine. do you need any help on any particular portion of your assignment..?

1. Please wrap your code with the CODE tags. People are more likely to reply if you do so.
2. What exactly are you having trouble with?

I don't know how to implement the random dice roll that will allow the user to skip a go. Thank for the help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.