windows 7运行qt终端

Running qt terminal for windows 7

本文关键字:终端 qt 运行 windows      更新时间:2023-10-16

我的程序(下面)可以编译,但它不允许我输入值。我看过很多线程,它们表示从运行中单击终端框,但这只会弹出一个窗口,说明"按下关闭此窗口",这确实违背了目的。在这方面有任何帮助就太好了。由于

#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;
}

如果您需要在终端上运行程序,这里已经解决了:使用Qt Creator进行控制台输入

至少对我有用。