K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
执行代码int a=5, b=2; cout << a/b << endl;,输出结果为2.5
int a=5, b=2; cout << a/b << endl;
执行代码double c=5, d=2; cout << c/d << endl;,输出结果为2
double c=5, d=2; cout << c/d << endl;
执行代码int e=5, f=2; cout << (double)e / f << endl;,输出结果为2.5
int e=5, f=2; cout << (double)e / f << endl;
表达式5 / 2.0会触发整数除法,最终结果为2
5 / 2.0