电大本科C语言程序设计期末复习题
; // 将 aa 的值赋给 a
b=bb ; // 将 bb 的值赋给 b }
int fA () ; int
fB() ; };
int ABC::fA( ) { return a+b; } int ABC::fB( ) { return a*b; }
三、下列程序运行后的输出结果 1. # include
int s=0;
}
cout <<\<
i,s=15,56
2. # include
int a=10,b=20; cout < { int a=0,b=0; for (int i=1; i<6; i++) { a+=i; b+=a; } cout < for (int i=1; ; \ i++) { } i cout <50) break; \ i } f (i%2==0) s+=i; 11 / 25 电大本科C语言程序设计期末复习题 10 20 15 35 5 10 20 3. # include good!pass!nad!well! 4. # include { case \ char a[]=\ 20 int case \ i1=0,i2=0,i=0; cout while (a[i]) {<<\ case \ f (a[i]==\ cout <<\ f (a[i]==\ default: cout ++; <<\ } } cout < void main() {} char 4 3 a1=\ 5. # include SB(\ 12 / 25 i i i 电大本科C语言程序设计期末复习题 { int a[9]={2,4,6,8,10,12,14,16,18}; for (int i=0; i<9; i++) { cout < if ((i+1)%3==0) cout < 6. # include void main() { int x=10,y=25; LE(&x,&y); cout < 7. # include char *a[5]={\adre\ char *p1,*p2; p1=p2=a[0]; for (int i=0; i<5; i++) { if (strcmp(a[i],p1)>0) p1=a[i]; if (strcmp(a[i],p2)<0) p2=a[i]; } cout < 13 / 25 电大本科C语言程序设计期末复习题 worker cadre 8. # include for (int i=0; i s*=*a++; return s; } void main() { int a[]={1,2,3,4,5,6,7,8}; int b=LB(a,5)+LB(&a[3],3); cout <<\ } A(int aa,int bb) { a=aa; b=bb;
电大本科C语言程序设计期末复习题



