【问题标题】:Running qt terminal for windows 7为 Windows 7 运行 qt 终端
【发布时间】:2013-01-02 20:41:03
【问题描述】:

我的程序(如下)可以编译,但不允许我输入值。我看过许多线程说从运行中单击终端框,但这只会弹出一个窗口,说明“按下以关闭此窗口”,这确实违背了目的。对此的任何帮助都会很棒。谢谢

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

【问题讨论】:

标签: c++ qt terminal


【解决方案1】:

如果您需要使用终端运行程序,这里已解决:Console input with Qt Creator

至少它对我有用。

【讨论】:

    猜你喜欢
    • 2023-03-19
    • 1970-01-01
    • 2021-07-19
    • 2014-05-30
    • 2020-05-14
    • 2018-01-18
    • 2012-10-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多