For school, we use C++ as the language of choice. I am currently using QtCreator as an IDE, and for its GUI library, it is wonderful. The school is using Visual Studio.
However, most of the programs we are writing make use of cin and cout for input/output. cout works fine as output, as you can see what it puts out in the application output, but there is no way to provide to cin as if it were on a console, like Visual Studio uses for its C++.
An example:
#include <iostream>
#include <string>
using namespace std;
int main() {
string name;
cout << "Enter name: ";
cin >> name;
cout << "Your name is " << name << endl;
}
Is there a way to use a console or provide input to cin like in Visual Studio?
I am currently running OS X Leopard, if it matters.
In Preferences, under the Environment section, set the "Terminal" option to /Applications/Utilities/Terminal.app
, as pointed out by Alex Martelli.
Then, in the Projects tab, under Run Settings, check the box marked "Run in Terminal".
Now, QtCreator will use Apple's built-in Terminal.app instead of Qt's console, allowing for interactive input.