写出下列程序的执行结果是:__________________。[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][/br]#include [iostream][br][/br]using namespace std;[br][/br]void fl(int& x,int& y){int z=x;x=y;y=z;}[br][/br]void f2(int x,int y){int z=x;x=y;y=z;}[br][/br]int main(){[br][/br] int x=10,y=26;[br][/br] f1(x,y);[br][/br] f2(x,y);[br][/br] cout[<y<<endl;<br] return 0;[br][/br]}[br][/br]运行时的输出结果是( )。 A: 10 B: 16 C: 26 D: 36
- 运行下列程序,第1行输出是____,第2行输出是____,第3行输出是____。[br][/br]#include[ iostream ][br][/br]using namespace std;[br][/br]int a, b(1);[br][/br]int main( )[br][/br]{[br][/br] int a=2;[br][/br] {[br][/br] int a=3;[br][/br] a+=10;[br][/br] b+=10;[br][/br] cout[<a+b<<endl;<br] }[br][/br] a+=100;[br][/br] b+=100;[br][/br] cout[<a+b<<endl;<br] cout[<::a+::b<<endl;<br] return 0;[br][/br]}
- 下列程序的输出结果为( )。 A: 10,20,30 B: 35,7,5 C: 35,20,10 D: 10,20,35<br> <br> E: include<br> using namespace std;<br> int fun(int a,int b,int c)<br> { <br> a=5;<br> b=a+2;<br> c=a*b;<br> return (c);<br> }<br> int main()<br> {<br> int a=10,b=20,c=30;<br> c=fun(a,b,c);<br> cout< return 0;<br> }
- 下面程序用于计算f,n)=1+2++n,其中power(m,n)求m”。请填写程序中相应语句。[br][/br]include <stdio.h>[br][/br]int power(int m,int n){[br][/br]int i;[br][/br][input=type:blank,size:4][/input];for(i=1;i<=n;i+)[br][/br][input=type:blank,size:4][/input];return p;}int f(int k,int n)[br][/br]{[br][/br]int i[br][/br][input=type:blank,size:4][/input];for(i=1;i<=n;i++)[br][/br][input=type:blank,size:4][/input];return s;}int main(void)[br][/br]{intk,n;[br][/br]scanf"%d%d",&k,&n);[br][/br]printf“f(%d,%d)-%ld”,k,n,fk,n);[br][/br]return 0;[br][/br]}[br][/br]
- Which of the following program is right? ( ) A: #include<br/>int main();<br/>{ /*programming*/<br/>printf("programming!\n");<br/>return 0;<br/>} B: #include<br/>int main()<br/>{ /*programming*/<br/>printf("programming!\n");<br/>return 0;<br/>} C: include <br/>void main()<br/>{ /*programming*/ <br/>printf("programming!\n");<br/>return 0;<br/>} D: #include<br/>int mian()<br/>{ /*programming*/<br/>printf("programming!\n");<br/>return 0;<br/>}