C++ 如何修复错误。。。类型为';int';和';浮动';到二进制';操作员%';?

C++ 如何修复错误。。。类型为';int';和';浮动';到二进制';操作员%';?,c++,C++,我找到了其他运算符的答案,但似乎%有自己的属性: #include <iostream> #include <cmath> using namespace std; int main() { float pprice; cout << "Enter the purchase price =>" << endl; cin >> pprice; float cash = 10000%pprice; return 0; } #包

我找到了其他运算符的答案,但似乎%有自己的属性:

#include <iostream>
#include <cmath>

using namespace std;

int main()

{
float pprice;
cout << "Enter the purchase price =>" << endl;
cin >> pprice;
float cash = 10000%pprice;
return 0;
}
#包括
#包括
使用名称空间std;
int main()
{
浮冰;
许可证;
浮动现金=10000%pprice;
返回0;
}
//错误:“int”和“float”类型的操作数对二进制“operator%”无效


这只是显示相同错误的代码示例。请告诉我如何修复此错误?

运算符仅对类型
int
有效。对于float,您需要使用。

以重复方式结束,这就解释了错误,尽管我想知道您是指
pprice%10000