强制类型转换优先级

强制类型转换优先级

#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
*/ 
posted @ 2022-10-29 09:21  new-code  阅读(97)  评论(0)    收藏  举报