首页 > 试题广场 >

写出下列程序的运行结果:

[问答题]
写出下列程序的运行结果:

#include<iostream>
using namespace std;
void main(){
 double x=10.5;
 char* y="hello world";
 cout<<x*2<<endl;
 cout<<(int)x<<" "<<(short)x<<endl;
 cout<<y[4+3]<<endl;
}
第一个输出,2*10.5结果为21
第二个输出,(int)x,10.5取整为10.  (short)x  短整型 结果为10
第三个输出  y[4+3]  输出字符串“hello world”的第七个字符,即为o
 
发表于 2019-10-30 09:45:20 回复(0)