以下程序的输出结果是( )。 #include<iostream.h> main() { int m=5: if(m++>5) cout<<m; else cout<<m--; }

admin2016-10-28  16

问题 以下程序的输出结果是(    )。
#include<iostream.h>
main()
{
int m=5:
if(m++>5)
cout<<m;
else cout<<m--;
}

选项 A、7
B、6
C、5
D、4

答案B

解析 此题中,因为m++>5成立(此时m的值变为6),所以执行语句cout<<m;输出结果为6。
转载请注明原文地址:https://kaotiyun.com/show/iONp777K
0

最新回复(0)