下列程序输出的结果是()。 #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
A: BABBAB
B: ABBBBA
C: ABBABA
D: ABABBA
举一反三
- 下列程序输出的结果是( )。 #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<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】 。
- 下列程序输出的结果是( )。#includefunl(chara,charb){charC;c=a;a=b;b=C;)fun2(char*a,charb){charC;c=*a;*a=b;b=c;)fun3(char*a,char*b){charC;C=*a;*a=*b;*b=C;)voidmain( ){chara,b;a='A';b='B';fun1(a,b);putchar(a);putchar(b);a='A';b='B';fun2(&a,b);putchar(a);putchar(b);a='A';b='B';fun3(&a,&b);putchar(a);putchar(b);putchar('\n');}[1分]
- 有以下程序 #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’;
- 以下程序的输出结果是 #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); }