cout不产生输出
cout does not produce output
所以我在一个对象的方法中,但cout语句根本不产生输出。
#include <iostream>
#include <stdio.h>
Object::Method()
{
printf("why is the next line not printing? This one prints finen");
std::cout << "This line should print second, but doesnt" << std::endl;
printf("but this line prints fine like the first!n");
}
输出为:
为什么下一行没有打印?这张打印出了很好的
但这一行打印得和第一行一样好!
我似乎不明白为什么它不会印刷。CCD_ 1也没有作用。
您应该使用std::cout
(C++流(或C样式流。将它们混合可能会产生未定义的行为。
例如,它们可以有单独的"缓冲"通道。
代码片段在我的系统上运行良好,您的问题可能来自此处未列出的代码的其他部分。尝试在方法的开头使用fflush(stdout)
,看看它是否有效。
相关文章:
- 为什么在C的循环中使用printf的Rust代码不显示输出,而在C++的循环中显示std::cout
- std::cout输出int时出现编译错误
- COUT 无法提供输出可能是由于内联组装
- 为什么我的 cout 在输出中没有显示字符串?
- 调用 cout 时如何在结构中输出常量文本?
- 如何在C++中编写 ostream 的向量,它接收所有不同的输出流,如 cout、ostringstream 和 ofs
- Vscode/C++ - cout 无法输出完整的句子,也无法与整数连接
- 我的 cout 上有一个奇怪的输出,它把答案放在第一位,然后在我调用它的地方放一个奇怪的输出.我该怎么办?
- 在 CPP 中使用 cout 的重复输出
- 在 c++ 中使用 cout.precision() 的奇怪输出
- 为什么'std::cout << !+2 '输出 0?
- 对于输出,std::copy是否比std::cout快
- 在视觉工作室中以十六进制进行位移位并通过 cout 输出
- 输出使用 cout 转换为 ASCII 的文本时输出格式不正确,C++
- 如何从控制台 c++(从 cout)捕获输出
- 为什么cout输出内存地址不是字符串?
- Jupyter笔记本未显示C 输出(COUT)
- 输出 cout 是感叹号.C++
- 无法从C++循环实现所需的输出 (COUT)
- "定向到标准输出(cout)"是什么意思?