I'm making a program for my university coursework which is to make a 3 question, multiple choice quiz. I emailed my half finished code to myself and when I loaded it onto my laptop, error LNK1120 popped up. This was not an the other computer.
#include <cstdlib>
#include"stdahx.h"
#include <iostream>
usingnamespace std;
int main(void)
{
int X = 0;
string questions[100]={};
string questionAnswers[100][100]={};
questions[0] = "What is the function of a binary Adder?";
questionAnswers[0][1] = "To add two binary number together.";
questionAnswers[0][2] = "To add two numbers together.";
questionAnswers[0][3] = "To add two denary numbers together.";
questionAnswers[0][4] = "Potato";
questions[1] = "What is the purpose of the stack?";
questionAnswers[1][1] = "A data structure that stores information about the active subroutines of a computer program.";
questionAnswers[1][2] = "A date structure.";
questionAnswers[1][3] = "A place where algorithms go.";
questionAnswers[1][4] = "A place where Potato's go.";
questions[2] = "What is the difference between DC and AC?";
questionAnswers[2][1] = "DC is a constant current while AC alternates from positive to negative";
questionAnswers[2][2] = "DC is the opposite to AC";
questionAnswers[2][3] = "DC is good electricity and AC is bad electricity.";
questionAnswers[2][4] = "One is made with Potato's, the other isn't.";
cout << "Welcome to the test!\n\n";
system("PAUSE");
cout << "\nAll questions are multiple choice,\nso answer each question with either 1, 2, 3 or 4.\n\n";
system("PAUSE");
cout << "\nCorrect answer is worth 2 marks, a mostly correct answer is worth 1 mark,\na wrong answer is worth 0 marks and a very wrong answer is worth -1 marks.\n\n";
system("PAUSE");
cout << "\nOk, lets go!\n\n";
system("PAUSE");
system("CLS");
while (X == 0)
{
X++;
cout << "Question " << X <<":\n";
X = X - 1;
cout << questions[X] << "\n";
cout << "1. " << questionAnswers[X][1] << "\n";
cout << "2. " << questionAnswers[X][2] << "\n";
cout << "3. " << questionAnswers[X][3] << "\n";
cout << "4. " << questionAnswers[X][4] << "\n";
X++;
}
system("PAUSE");
system("CLS");
cout << "WELL DONE FOR DOING GOOD.";
system("PAUSE");
return 0;
}
Please help! I've searched for fixes on the forum and none of them work!
error C2451: conditional expression of type 'std::basic_string<_Elem,_Traits,_Ax>' is illegal
And this points to the line
if(questions[X] = "\0")
where X is a variable that increases in one every so often (This is something I found on the web to check whether a string array place is empty or not, so sorry if it's completely wrong)