首页题目详情
在Visual Basic中,如何定义一个接受两个整数参数并返回它们之和的函数?

A.Function Sum(a As Integer, b As Integer) As Integer
B.Sub Sum(a As Integer, b As Integer) As Integer
C.Public Function Sum(a, b) As Integer
D.Function Sum(a As Integer, b) As Integer
优质解答
答案
A
解析
Visual Basic中定义函数时,参数类型需明确指定,使用Function关键字而非Sub,并且明确返回类型为Integer。
Visual Basic语言程序设计单选题中等AI生成