繁体   English   中英

为Windows 7运行QT终端

[英]Running qt terminal for windows 7

我的程序(下面)可以编译,但是不允许我输入值。 我看过许多线程,它们要求单击运行中的接线盒,但这只会弹出一个窗口,指出“按此关闭窗口”,这实际上是违背了目的。 任何帮助都会很棒。 谢谢

#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的控制台输入

至少对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM