有以下程序 #include<stdio.h> sub1(char a,char B) char c;c=a;a=b;b=c; sub2(char *a,char B) char c;c=*a;*a=b;b=c; sub3(char *a,char *B) char c;c=*a;*a=*b;*b=c; main() cha,a,b; a=’A’;b=’B’;sub3(&a,&b) putchar(
A: ;putchar(
B: ;
C: a=’A’;
A: ;putchar(
B: ;
C: a=’A’;
举一反三
- 以下程序的输出结果是 #include"stdio.h" sub1(chara,charb){charc;c=a;a=b;b=c;} sub2(char*a,charb){charc;c=*a;*a=b;b=c;} sub3(char*a,char*b){charc;c=*a;*a=*b;*b=c;} main() {chara,b; a='A';b='B';sub3(&a,&b);putchar(a);putchar(b); a='A';b='B';sub2(&a,b);putchar(a);putchar(b); a='A';b='B';sub1(a,b);putchar(a);putchar(b); }
- 下列程序输出的结果是( )。 #include<stdio.h> fun1(char a,char b) char c;c=a;a=b;b=c; fun2(char*a,char b) char c;c=*a;*a=b;b=c; fun3(char*a,char*b) char c;c=*a;*a=*b;*b=c; void main() char a,b; a=’A’;b=’B’; fun1 (a,b);putchar( A: ;putchar( B: ; C: a=’
- 下列程序输出的结果是()。 #include<stdio.h> un1(char a,char b){char c;c=a;a=b;b=c;} fun2(char*a,char b){char c;c=*a;*a=b;b=c;} fun3(char*2,char*b){charc;c=*a;*a=*b;*b=c;} void main() { char a,b; a='A';b='B';funl(a,b);putchar(a);putchar(b); A: BABBAB B: ABBBBA C: ABBABA D: ABABBA
- 读程序写结果。( ) #include“stdio.h” main() { char a,b,c; a=‘B’;b=‘O’; c=‘Y’; putchar(a); putchar(b); putchar(c); putchar(‘’);printf(“”);}
- 阅读下面程序:#include<iostream.h>void funl(char a,char b){ char c; c=a;a=b;b=C;}void fun2(char &a,char b){ char c; c=a;a=b;b=c;}void fun3(char &a,char &b){ char c; c=a;a=b;b=C;}void main(){ char a,b; a=’A’;b=’B’; funl(a,b);cout<<a<<b; a=’A’;b=’B’; fun2(a,b);cout<<a<<b; a=’A’;b=’B’; fun3(a,b);cout<<a<<b;} 则该程序的输出为 【15】 。