#include <iostream>
int main()
{
using std::cout;
using std::endl;
using std::cin;
short width;
short legnth;
short height;
short volume;
volume = (legnth * width * height);
cout << "This program will determine the volume of a cube" << endl;
cout << "Enter the legnth of the cube: ";
cin >> legnth >> endl;
cout << "Enter the width of the cube: ";
cin >> width >> endl;
cout << "Enter the height of the cube: ";
cout << "Your volume is: " << volume;
cout << "Press any key to exit :)";
cin.get();
return 0;
我是 C++ 的新手,在我的基础计算机编程课上,我们必须制作一些可以计算体积的东西,有人可以帮我解决这个错误吗?
最佳答案
您不能从 cin
提取到 endl
- 这没有任何意义。您将 endl
与输出流一起使用以插入换行符并刷新流。只需删除 >> endl
。
此外,您拼错了 length
。
关于c++ - 在 C++ 中出现此错误, "no match for ' operator>>' in ' std :cin. std,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22081563/