Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Array troubles (http://www.go4expert.com/forums/array-troubles-t20822/)

Brett.h 31Jan2010 00:04

Array troubles
 
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
}
}

xpi0t0s 31Jan2010 21:48

Re: Array troubles
 
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.


All times are GMT +5.5. The time now is 08:09.