以下正确的函数原型为()。 |
单选 |
有函数原型void fun2( int );,在下列选项中,不正确的调用是()。 |
单选 |
阅读下列程序,写出运行结果: #include<iostream> using namespace std; void func( int, int, int & ); int main() { int x=0, y=1, z= |
问答 |
阅读下列程序,写出运行结果: #include<iostream> using namespace std; void func( int *, int *, int *& ); int main() { int a=10, b |
问答 |
阅读下列程序,写出运行结果: #include<iostream> using namespace std; int f2( int, int ); int f1( int a, int b ) { int c; a += a; b + |
问答 |
阅读下列程序,写出运行结果: #include<iostream> using namespace std; int age( int n ) { int f; if( n == 1 ) f = 10; else f = |
问答 |
阅读下列程序,写出运行结果: #include<iostream> using namespace std; int f1( int a, int b ) { return a + b; } int f2( int a, int b ) |
问答 |
阅读下列程序,写出运行结果: #include<iostream> using namespace std; int sub( int, int ); int a = 1; int main() { int m = 1, n = 2, |
问答 |
函数的作用是什么?如何定义函数?什么是函数原型? |
问答 |
什么是函数值的返回类型?什么是函数的类型?如何通过指向函数的指针调用一个已经定义的函数?编写一个验证程序进行说明。 |
问答 |
什么是形式参数?什么是实际参数?C++函数参数有什么不同的传递方式?编写一个验证程序进行说明。 |
问答 |
C++函数通过什么方式传递返回值?当一个函数返回指针类型时,对返回表达式有什么要求?当返回引用类型时,是否可以返回一个算术表达式?为什么? |
问答 |
变量的生存期和变量作用域有什么区别?请举例说明。 |
问答 |
静态局部变量有什么特点?编写一个应用程序,说明静态局部变量的作用。 |
问答 |
在一个语句块中能否访问一个外层的同名局部变量?能否访问一个同名的全局变量?如果可以,应该如何访问?编写一个验证程序进行说明。 |
问答 |
有函数原型 void f (int & n); 和函数调用 int a; //… f(a); 有人说,因为n是a的引用,则在函数f中访问n相当于访问a,所以,可以在f的函数体内直接使用变量名a。这种说法正确吗 |
问答 |
有以下程序: #include<iostream> using namespace std; int main() { char c; cin>>c; if(c=='y'||c==' |
问答 |
有函数原型 double function(int,double); 函数function的返回值类型是什么?函数的类型是什么?使用typedef定义函数的类型。 有函数调用语句 x=function(10,(2* (0.314 |
问答 |
请分析以下各语句的意义。 int * fun(); int * (*pf)(); fun(); pf = fun; pf(); |
问答 |
已知 ,其中,sh为双曲正弦函数,即。编写一个程序,输入x的值,求y的值。 |
问答 |