gpt4 book ai didi

c++ - 运行 Windows 7 的 qt 终端

转载 作者:行者123 更新时间:2023-11-28 07:48:14 25 4
gpt4 key购买 nike

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

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

最佳答案

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

至少它对我有用。

关于c++ - 运行 Windows 7 的 qt 终端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14410756/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com