QtCreator 2.4.1 console input
-
I'm somewhat new and C++ and just starting with Qt. Trying to run a very simple program in QtCreator, which uses console input on WinXP:
@#include <QString>
#include <QTextStream>
QTextStream cout(stdout);
QTextStream cin(stdin);int main() {
QString s2;
cout << "Enter a sentence: ";
s2 = cin.readLine();
cout << "Here is your sentence:" << s2 << endl;
cout << "The length of your sentence is: " << s2.length() << endl;
return 0;
}@But QTCreator's application output doesn't seem to allow typing in things. I've tried checking "Run in terminal" in Projects>Desktop>Run and the terminal shows up, but it seems kind of detached.It only contains "Press RETURN to close this window..." string printed and doesn't seem to interact with the program anyhow. Thanks in advance.
-
After operator
@cout << "Enter a sentence: ";@you must insert operator
@cout.flush();@
-
Than You VanDerSam