Reputation: 1
My program (below) compiles but it will not allow me to enter the values. I've looked at many threads stating to click the terminal box from run but that only brings up a window stating "Press to close this window," which really defeats the purpose. Any help on this would be great. Thanks
#include <QCoreApplication>
#include <QTextStream>
//using namespace std;
QTextStream cin(stdin);
QTextStream cout(stdout);
int main()
{
QString firstName;
QString lastName;
QString houseNumber;
QString streetName;
QString streetType;
QString city;
QString state;
QString zipCode;
QString phone;
cout<<"Please enter your first name: " << endl;
cin >> firstName;
cout << endl <<"Please enter your first name: " << endl;
cin >> lastName;
cout << endl <<"Please enter your house number: " << endl;
cin >> houseNumber;
cout << endl <<"Please enter your street Name: " << endl;
cin >> streetName;
cout << endl <<"Please enter your street type (i.e. Rd, St, Blvd, ect): ";
cin >> streetType;
cout << endl <<"Please enter your city: " << endl;
cin >> city;
cout << endl <<"Please enter your state: " << endl;
cin >> state;
cout << endl <<"Please enter your zip code: " << endl;
cin >> zipCode;
cout << endl <<"Please enter your phone number: " << endl;
cin >> phone;
cout << endl << "Your information is: " << endl << endl;
cout << firstName <<" "<<lastName<<endl;
cout << houseNumber << " " << streetName << " " << streetType << endl;
cout << city << ", " << state << " " << zipCode << endl;
cout << "Phone Number: " << phone << endl << endl;
return 0;
}
Upvotes: 0
Views: 308
Reputation: 714
If you need to run the program with a terminal it has been solved here: Console input with Qt Creator
At least it worked for me.
Upvotes: 1