若有以下类型说明语句:char a; int b; float c; short int d;

[复制链接]
查看11 | 回复3 | 2013-9-8 10:41:27 | 显示全部楼层 |阅读模式
#includeusing namespace std;int main() {char a=1; int b=1; float c=1.123123; short int d=1;cout<<(c*b+a)*d<<endl;cout<<typeid((c*b+a)*d).name()<<endl;return 0;}D float我把它运行了一下...
回复

使用道具 举报

千问 | 2013-9-8 10:41:27 | 显示全部楼层
应该是float。c*b==float +a 提升为int ()里面还是float *d 提升int 还是float...
回复

使用道具 举报

千问 | 2013-9-8 10:41:27 | 显示全部楼层
double值类型按照里面范围大的来取...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行