简体   繁体   English

QT Creator简单应用

[英]QT Creator simple application

I'm developping a very simple app on my Ubuntu using QtCreator. 我正在使用QtCreator在Ubuntu上开发一个非常简单的应用程序。

It's a console application and I want the user to enter its name, and then I display his name. 这是一个控制台应用程序,我希望用户输入其名称,然后显示其名称。 Here is the code : 这是代码:

#include <iostream>

int main(int ArgC, char* ArgV[])
{
    char Name[1000];

    std::cout << "Type your name : ";
    std::cin >> Name;

    std::cout << "Hello " << Name << "\n";
    return 0;
}

When running this app with QtCreator, the string "Type your name :" is displayed in the 'Application Output' tab. 当使用QtCreator运行此应用程序时,“应用程序输出”选项卡中将显示字符串“输入您的姓名:”。 But if I type some text and press the enter key, nothing is happening. 但是,如果我键入一些文本并按Enter键,则什么都没有发生。

What's wrong ? 怎么了 ?

Looks like "Application Output " tab doesn't support Input . 看起来“应用程序输出 ”选项卡不支持输入 Try to start your application in standalone console. 尝试在独立控制台中启动您的应用程序。

在Qt中编码时,不应使用std :: cout&library

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

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