Your code tags need work.
They should be
your code here
Please edit your posts.
Questions.cpp
line 14: Remove the ; from your constructor.
Line 19: The function declaration for getQuestion() is commented out.
Line 23: Ditto for getAnswer().
Line 34: Ditto for showQuestion().
Line 34: showQuestion should be qualified by the class name.
test.cpp
Line 15:
asking[i + 1].getQuestion()
is going to cause an out of bounds reference. Members of the array are 0-4. You're trying to reference [5] on the last iteration.
Line 17:
asking.getQuestion()
asking needs a subscript.
Line 21:
if(operator == (asking[i].getAnswer(), playerInput))
That's an odd way to do the comparision. Consider:
|
if (asking[i].getAnswer() == playerInput)
|
line 21:
getline(cin (playerInput));
You need a , between cin and playerinput.
line 30:
void Test::add()
Does not match the function declaration.
Line 31: You add a question, but you don't adjust current.
Line 34:
void Test::getCorrectCount()
You're trying to return a value from a void function. Also, does not match the function declaration.
Line 38: Ditto for getWrongCount().
main.cpp
Line 13: Don't declare questions here. They're part of Test.
Line 16: string does not belong in front of your open.
Line 27: stream and var are undefined. My use of stream and var in my previous post about eof was only an example. What you want is:
1 2
|
while (getline(inputFile, question) && getline(inputFile, answer))
|
Line 32: You should be adding your Question object to Test (which you haven't declared).
Line 37: Again, you need to instantiate Test and make a proper function call.
1 2 3 4
|
Test test;
...
test.giveTest();
|
Line 39:
Test.getCorrectCount()
Test is a class name, not an instance of the class.
Note: My line numbers are approximate since your code tags were messed up and I had to guess.