下列程序的输出结果是   #include" iostream"   using namespace std;   int Max(int a,int b)    {     if(a > b)     else       return a;     e

admin2013-02-27  15

问题 下列程序的输出结果是   #include" iostream"   using namespace std;   int Max(int a,int b)    {     if(a > b)     else       return a;     else      retum b;     }     void main( )     {      int m,n;      m=10,n=5;      int max=Max(m,n);      cout < < max < < end

选项 A、10
B、程序有误
C、1
D、0

答案1

解析 本题函数Max的功能是求出两个整数中的较大者,并且通return语句返回。注意:retum语句的用法,注意return的条件。
转载请注明原文地址:https://kaotiyun.com/show/FeVp777K
0

随机试题
最新回复(0)