#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<
举一反三
- 写出下列程序的执行结果是:__________________。#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;}
- 1、写出下列程序的输出结果 #include [iostream] using namespace std; int b=2; int func(int *a) { b+=*a; return(b); } int main( ) { int a=2,res=2; res+=func(&a); cout<<res<<endl; return 0; }
- 有以下程序: #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
- 写出下列程序的执行结果是:__________________。#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 );}
- 阅读以下程序,a的值为#include<stdio.h>int a;int f1(int b, int c, int d);int f2(int b, int c);int f3(int b);int f1(int b, int c, int d) { return f2(b*c, d);}int f2(int b, int c) { return f3(b*c);}int f3(int b) { a = b; return a == 32;}int main() { int b = 2, c = 4, d = 8, ans; a = 1; ans = f1(b, c, d); return 0;} A: 1 B: 2 C: 32 D: 64