Code:
#include <iostream>
using namespace std;
/*Variables-------------------------------------------------------------------*/
int x = 0; //Keeps track of what problem number your currently working with.
int y = 0; //Keeps track of the total questions.
int l = 0; //Used to keep track of the second dimension in char answer[][]
char answer[10][2]; //Keeps track of correct answers and answers submitted by user.
For right now I'm just assuming there will be 10 questions with 10 corresponding answers etc etc.
It's going to be really messy to fix this later, but I figure that will be a learning experience for another day.
Probably when I try to tackle using classes.
string question[10]; //Stores the question text to display to the user.
string a[10]; //Stores the text of answer option a to display to the user.
string b[10]; //Stores the text of answer option b to display to the user.
string c[10]; //I think your getting it by now
string d[10]; //Sure hope so at east.
string input;
string help = " Type HELP to view a list of available commands./n Type OPEN to load a new quiz file./n
Type A, B, C, or D to answer the question./n";
int grade; //Stores the final score
/*Function Prototypes---------------------------------------------------------*/
void loader(int x, string question[x], string a[x], string b[x], string c[x], string d[x], char answer[x][2]);
void submit(string input, int x, int y, char answer[x][1]);
void score(int x, char answer[x][l], int grade);
void display(int x, int y, string question[x], string a[x], string b[x], string c[x], string d[x], char answer[x][1]);
/*Int Main--------------------------------------------------------------------*/
int main() {
cout<<help;
cin>>input;
cin.ignore();
if (input == "OPEN") {
loader(x, question[x], a[x], b[x], c[x], d[x], answer[x][2]);
y==10
}
else if (input == "HELP") {
cout<<help;
}
else if (input == "A" || input == "B" || input == "C" || input == "D" && y > 0) {
submit(input, x, y, answer[][1]);
display(x, y, question[x], a[x], b[x], c[x], d[x], answer[x][1]);
}
cin.get();
}
/*Function: Loader------------------------------------------------------------*/
void loader (int x, string question[x], string a[x], string b[x], string c[x], string d[x], char answer[x][2]) {
}
/*Function: Submit------------------------------------------------------------*/
void submit (string input, int x, int y, char answer[x][1]) {
answer[x][1] = answer
x = x++
}
/*Function: Score-------------------------------------------------------------*/
void score (int x, char answer[x][l]) {
for (x = 0; x < y; x++) {
if answer[x][1] == answer[x][2] {
grade = grade++
}
}
}
/*Function: Display-----------------------------------------------------------*/
void display (int x, int y, string question[x], string a[x], string b[x], string c[x], string d[x], char answer[x][l]) {
if x > y {
score(int x, char answer[x][l], int grade);
else {
}
}
As you can see the question at hand is actually used in a lot more places than are turned red, but that specific example seemed like it would be the simplest and once I understand that part I should be able to get the rest.