分数转化为整int,int a=2/3,是0; int c=7/5;是1;不存在四舍五入。
不存在四舍五入。
#include <iostream>
using namespace std;
int main ()
{
int a=2/3;
int b=3/4;
int c=7/5;
cout << a << endl;
cout << b << endl;
cout << c << endl;
return 0;
}
结果:
0 0 1