以下函数定义中正确的是 ()以下函数定义中正确的是 () .A.double fun(double x,double y){ } B.double fun(double x;double y){ }C.double fun(double x,double y);{ } D.double fun(double x,y){ }A.double fun(double x,double y){ } B.double fun(double x;double y){ }C.double fun(double x,double y);{ } D.double fun(double x,y){ }

问题描述:

以下函数定义中正确的是 ()
以下函数定义中正确的是 () .
A.double fun(double x,double y){ }
B.double fun(double x;double y){ }
C.double fun(double x,double y);{ }
D.double fun(double x,y){ }A.double fun(double x,double y){ }
B.double fun(double x;double y){ }
C.double fun(double x,double y);{ }
D.double fun(double x,y){ }

A. double fun(double x,double y){ }
B. double fun(double x;double y){ }
C. double fun(double x,double y);{ }
D. double fun(double x,y){ }
双参数函数的定义格式:
typename0 functionname(typename1 var1, typename2 var2){}
其中各部分都是必须的,于是,A正确,其他错误。

A对
B错在x后面应该是逗号,而不能是分号;
C错在原括号后面多了个分号;
D.定义的时候就算是相同类型的变量也要分开写的.