强制类型转换优先级
强制类型转换优先级
#include<bits/stdc++.h>
using namespace std;
int main(){
float temp=0;
float a=1.1;
float b=2.1;
temp=a+b;
cout<<temp<<endl;
temp=(int)a+b;//强制类型转换优先级 高于四则运算
cout<<temp<<endl;
}
/*
输出:
3.2
3.1
*/
作者:newcode 更多资源请关注纽扣编程微信公众号

从事机器人比赛、机器人等级考试、少儿scratch编程、信息学奥赛等研究学习

浙公网安备 33010602011771号