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

admin2010-03-29  32

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

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

答案1

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

随机试题
最新回复(0)