Console input with Qt Creator

前端 未结 6 1095
执笔经年
执笔经年 2020-12-03 00:54

I\'m developping a very simple app on my Mac using QtCreator.

It\'s a console application and I want the user to enter its name, and then I display his name. Here is

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 01:45

    Go to Project -> Run settings, and make sure "Run in Terminal" is checked.

    BTW:

    std::cin >> Name;
    

    is probably not what you want. It will read just a single token (typically only the first name). You should have a look at getline, or the string version.

提交回复
热议问题