[ create a new paste ] login | about

Link: http://codepad.org/bXp3T8Wq    [ raw code | output | fork ]

C++, pasted on Dec 13:
#include <iostream>
#include <fstream>
#include <cctype>
#include <cstring>
#include <stdlib.h> /* srand, rand */
#include <iomanip>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <string.h>

using namespace std;

string LoadExam();

string DisplayExam();

int main()

{

int choice;

do

{

cout << "1) Load an Exam" << endl;

cout << "2) Display the Exam" << endl;

cout << "3) Quit Program" << endl;

cin >> choice;

switch(choice)

{

case 1:

LoadExam();

break;

case 2:

void printDisplayExam();

break;

case 3:

cout << "Thank you for visiting. See you again later..." << endl;

break;

default:

cout << "Invalid Option" << endl;

}

} while (choice >= 1 || choice <= 3);

return 0;

}

void printDisplayExam()

{

string type;

string question;

char answer;

int NumbQuestions;

int valueOfQuestion;

int numbOfChoices;

char opt;

if (type == "TF"){

cout << "Enter in the question:" << endl;

cin.ignore();

getline (cin, question);

cout << "Enter in the answer:" << endl;

cin >>answer;

cout << NumbQuestions << endl;

cout << type << " " << valueOfQuestion << endl;

cout << question << endl;

cout << answer << endl;

}

if(type == "MC"){

cout << "Enter in the question:" << endl;

cin.ignore();

getline (cin, question);

cout << "Enter in the number of choices:" << endl;

cin >> numbOfChoices;

cout << "Enter in the options:" << "\nPlace a space before each entry"<< endl;

for(int i = 0; i < numbOfChoices; i++){

cin.ignore();

getline (cin, opt[i]);

}

cout << "Enter in the answer:" << endl;

cin >> answer;

cout << NumbQuestions << endl;

cout << type << " " << valueOfQuestion << endl;

cout << numbOfChoices << endl;

cout << question << endl;

for(int j = 0; j < numbOfChoices; j++){

cout << opt[j] << endl;

}

cout <<"Answer: "<< answer << endl;

}

}


Output:
1
2
3
In function 'void printDisplayExam()':
Line 130: error: invalid types 'char[int]' for array subscript
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: