When i compile and run the program with only this function working, it should assign consecutive line in a document to an array element, but it doesn't print out anything just the "\n" (line 6) no text??? void AI::init(){ test.open("greetings.txt"); for (int counter = 0; !test.eof(); counter++){ getline(test,tests); cout << tests /// this prints out the right output recognisedStatements[counter] == tests; cout << recognisedStatements[counter] << "\n"; //this doesn't } }
What does the == operator do? Does it assign or does it compare? Probably your compiler threw a warning at this line - code does nothing, or something along those lines.