问题 单项选择题

以下程序的输出结果是( )。
#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。

综合
名词解释