c++ - cin语句无法编译

标签 c++ compiler-errors cin

好的,尽管我的代码从理论上讲确实有效,但是我仍然面临编程难题,因此我想知道这是编译器问题(我使用Code::Blocks)还是我没有看到它。任何帮助将不胜感激,谢谢!

这是我的代码:

#include <iostream>

#include <string>

#include <math.h>

using namespace std;

int main(){

   double sliceStore, sliceSize = 14.125, totalSlice, area;

cout << "How Many Slices?" << endl;
//getline(cin,sliceStore);
cin >> sliceStore >> endl;

return 0;
}

最佳答案

从输入语句中删除“endl”!

关于c++ - cin语句无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32508717/

相关文章:

c++ - 大 O 表示法中的 next_permutation 时间复杂度

C++ 链接器错误 ("Linker command failed with exit code 1")

mysql - ErrorException (E_ERROR) undefined variable : buildingSections

c++ - C++ 中的 cin.get() 有问题吗?

c++ - cin 缓冲区有一些烦人的问题

c++ - super 菜鸟 C++ 变量帮助

c++ - 如何使用 qml 组件创建插件的 deb 包(无 C++)

c++ - 在 Sublime text 3 中编译简单的 C++ 程序时出错

c++ - 编译c++代码时出错 逗号运算符的右操作数不起作用

c++ - 如何在 C++ 中手动读取 PNG 文件?