自己在Dev里验证了,浮点数取模时有编译错误,通不过。
如:[Error] invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’
代码:
#include<iostream>
using namespace std;
int main()
{
float a=2.5;
float b=3.0;
// cout<<a%2<<endl; //[Erro
自己在Dev里验证了,浮点数取模时有编译错误,通不过。
如:[Error] invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’
代码:
#include<iostream>
using namespace std;
int main()
{
float a=2.5;
float b=3.0;
// cout<<a%2<<endl; //[Erro