符号 endl 和 cout 无法解析
symbol endl and cout could not be resolved
我从我正在阅读的一本书中编写了这段代码,但我的编译器警告说符号cout和endl无法解析。为什么。
#include <iostream>
#include <float.h>
int main()
{
cout << "float: " << endl
<< "stevilo decimalnih mest: " << FLT_DIG << endl
<< "natancnost stevila....: " << FLT_EPSILON << endl
<< "Najmanjse stevilo.....: " << FLT_MIN << endl
<< "Najvecje stevilo......: " << FLT_MAX << endl
<< "Bitov v mantisi.......: " << FLT_MANT_DIG << endl
<< "Najvecji eksponent....: " << FLT_MAX_10_EXP << endl
<< "Najmlajsi eksponent...: " << FLT_MIN_10_EXP << endl;
return 0;
}
您必须使用命名空间:
#include <iostream>
#include <float.h>
using namespace std;
或:
std::cout
您可以在此处阅读有关 c++ 中命名空间的更多信息
cout
和endl
的作用域。因此,您必须告知在哪个命名空间中。
用
std::cout
std::endl
或在包含后添加错误
using namespace std;
相关文章:
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- std::cout << glGetString(GL_RENDER) << std::endl;抛出错误但不GL_Renderer或GL_Verision,我不知道为什么?
- "cout<<count<<endl;"没有打印任何内容
- 使用 std::endl 与 "n" 当 cin 和 cout 被解绑时
- std::cout doen不喜欢 std::endl 和 String in conditional-if
- 在 Cout << "hello" << endl 中删除 endl 后,我的C++程序停止工作
- 为什么在语句"std::cout << std::endl;"中使用时需要命名空间限定,给定依赖于参数的查找?
- Cout 不会打印文本而没有 endl 在循环中?
- 为什么要编译endl(std::cout)
- 为什么"std::cout << myVector[x][x] << std::endl"会产生下标错误?
- std::cout 不打印带有 endl 的值(换行符说明符)
- 符号 endl 和 cout 无法解析
- 外置"C"时不能使用 cout/endl
- 在 AllocConsole 之前执行 std::endl 会导致不显示 std::cout
- 让"cout << obj1 + obj2 << endl;"发挥作用
- 我可以在C++中删除 ( cout<< " " <<endl ) 中的"endl"吗?
- c++中cout缓冲区和endl的结构
- #define print(msg) std::cout << msg << std::endl
- "n" 或 'n' 或 std::endl to std::cout?
- "cout&endl"和"boost"有什么问题?