C ++在Xcode控制台中不显示cout,但在Terminal中运行完美 [英] C++ not showing cout in Xcode console but runs perfectly in Terminal
问题描述
基本上我在中运行一个简单的程序Xcode Version 8.3(8E162)
#include< iostream>
使用命名空间std;
int main(){
int a;
cout<<< 你几岁: ;
cin>>一个;
cout<<< 我的年龄是<< a<终点
return 0;
}
我看到有关 cout
需要刷新,所有
这是用户输入并显示结果
这是在终端上,这正是我需要Xcode上的输出调试器。
通过做一些研究,在 cin和cout上似乎存在错误 stream on $ code Xcode Version 8.3 Buil d 8E162
发布于 2017年3月27日
。
降级到 Xcode版本8.2.1
像一个魅力一样。
Basically i am running a simple program in Xcode Version 8.3 (8E162)
#include <iostream>
using namespace std;
int main() {
int a;
cout << "What is your age: ";
cin >> a;
cout << "My age is " << a << endl;
return 0;
}
I have seen different questions about cout
need to be flushed and all std::cout won't print and Xcode debugger not showing C++ cout output. The Xcode debugger does not print cout
until i put \n or endl
. But, it works perfectly fine on terminal.
What if i had to use What is your age:
and the user input age in the single line rather than the next line putting \n and endl
?
This is what the Xcode debugger shows after build and run
This is when user inputs and it displays the result
This is on the terminal and this is what exactly what i need the output on the Xcode debugger.
By doing some research, there seems to be bug on cin and cout
stream on Xcode Version 8.3 Build 8E162
released on Mar 27, 2017
.
Degrading to Xcode Version 8.2.1
works like a charm.
这篇关于C ++在Xcode控制台中不显示cout,但在Terminal中运行完美的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!