当前位置:首页 > C语言题库
#include
void main() {char ch;
cout<<\请输入一个字母'Y','y'或'n','N':\cin>> ch ; yesno(ch); }
8、以下程序的运行结果是 9 。 #include
{int z;z=x+y;return z; }
void main() { int a=4,b=5;cout< 9、以下程序的功能是 1 2 6 24 120 。 #include {static int f=1;f=f*n;return(f); } void main() { int i;for(i=1;i<=5;i++) cout< 10、以下程序的输出结果是 2 。 #include int fun(int x,int y) { int m=3; return(x*y-m); } 29 void main() { int a=7,b=5; cout< 解:在主函数中调用fun(a,b)时,m=3是内部变量,返回x*y-m=7*5-3=32。然而主函数中m是外部变量,m=13,所以程序的输出结果(32/13的结果值)为:2。 11、以下程序的执行结果是 4 4 。 #include void func(int a) { int m=0; m=m+a; cout< 12、以下程序的执行结果是 a=10,b=3 。 #include swap() { int temp; temp=a; a=b; b=temp; } 13、以下程序的执行结果是 x=4 。 #include 30 { x=4; } void main() { sub(); cout<<\} 14、以下程序的执行结果是 a=5 a*a=25 a*a*a=8。#include void p1() { cout<<\ a=2; } void p2() { cout<<\} 15、以下程序的执行结果是1.x=3 2.x=6 3.x=1 4.x=3。 #include 31 cout<<\} void p1() { x=x+1; cout<<\} void p2() { int x=1; cout<<\} 16、以下程序的运行结果是 max is 2 。 #include int max(int x,int y) { int z; z=(x>y)?x:y; return(z); } 17、以下程序的运行结果是 10 20 40 40 。 #include void main() { int x3=10,x4=20; sub(x3,x4); sub(x2,x1); cout< 32
共分享92篇相关文档