I can not understand what is wrong, why does the comparison in the while not work?
#include <iostream> int main() { using namespace std; char word[20]; int count = 0; cout << "<Enter separate letter 'q' in the end of text>\n"; cout << "Enter the text:\n"; cin >> word; while (word != "q") { count++; cin >> word; } cout << count << " words in the text.\n"; system("pause"); return 0; } Input example: one two three q
There should be a conclusion: 3 words in the text.