写出下列程序的执行结果是:__________________。#include<;iostream>;using namespace std;int f2( int, int );int f1( int a , int b ){ int c ; a += a ; b += b ; c = f2( a+b , b+1 ); return c;}int f2( int a , int b ){ int c ; c = b % 2 ; return a + c;}void main(){ int a = 3 , b = 4; cout <;<; f1( a , b ) <;<; endl;}
举一反三
- #include [iostream] using namespace std; int f2( int, int); int f1(int a,int b) {int c; a+=a;b+=b; c=f2( a+b,b+1); return c; } int f2( int a,int b) {int c; c=b%2; return a+c; } void main() {int a=3,b=4; cout<<f1(a,b)<<endl; }程序的输出结果为________________。
- 写出下列程序的执行结果是:__________________。#include<;iostream>;using namespace std;int f1( int a, int b ) { return a + b ;}int f2( int a, int b ){ return a - b ;}int f3( int( *t )( int, int ), int a, int b ) { return ( *t )( a, b ) ;}void main(){ int ( *p )( int, int ); p = f1 ; cout <;<; f3( p, 4, 8 ) <;<;","; p = f2 ; cout <;<; f3( p, 8, 4 );}
- 有以下程序: #include<iostream> using namespace std; int f(int,int); int main() { int i:1,x; x=f(i,i+1); cout<<x<<end1; return 0; } int f(int a,int b) { int c; c = a; if(a>b) c = 1; else if(a==b) c = 0; else c = -2; return c; } 运行后的输出结果是 。 A: 1 B: 0 C: -1 D: -2
- 写出下列程序的执行结果是:__________________。[br][/br]#include[br][/br]using namespace std;[br][/br]int f2( int, int );[br][/br]int f1( int a , int b )[br][/br]{ [br][/br] int c ;[br][/br] a += a ; b += b ;[br][/br] c = f2( a+b , b+1 );[br][/br] return c;[br][/br]}[br][/br]int f2( int a , int b )[br][/br]{ [br][/br] int c ;[br][/br] c = b % 2 ;[br][/br] return a + c;[br][/br]}[br][/br]void main()[br][/br]{ [br][/br] int a = 3 , b = 4;[br][/br] cout [< f1( a , b ) << endl;<br]}
- 有以下程序 int f1(int x,int y) {return x>y?x:y;} int f2(int x,int y) {return x>y?y:x;} main() { int a=4,b=3,c=5,d=2,e,f,g; e=f2(f1(a,b),f1(c,d)); f=f1(f2(a,b),f2(c,d)); g=a+b+c+d-e-f; printf("%d,%d%d\n",e,f,g); } 程序运行后的输出结果是()