阅读下面程序: #include<iostream.h> void fun1(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 main() { char a,b; a=’x’;b=’y’; fun1(a,b);cout<<a<<b; a=’x’;b=’y’; fun2(a,b);cout<<a<<b; } 则该程序的输出为______。
举一反三
- 阅读下面程序:#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】 。
- 已知函数调用语句:char c = fun( 'A', 5.5 ); 则该函数定义的函数头最有可能是( )。 A: void fun( char x, double y ) B: char function( char a, double b ) C: char fun( char c, double d ) D: char fun( double x, char y )
- 中国大学MOOC: 下面程序执行后的输出结果是:#include <iostream>using namespace std;void fun(char *c,char d){*c=*c+1; d=d+1;cout<<*c<<","<<d<<",";}int main(){char a=A, b=a;fun(&b,a); cout<<a<<","<<b<<endl;return 0;}
- 下列程序输出的结果是( )。 #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=’
- 有以下程序 void fun(char *a,char *b) a=b; ( * A: ++; <