写出下列程序的运行结果 [11] 。 #include<iostream. h> void func(double x, int &part1, double &part2){ part1=int(x)+500: part2=(x+500-part1)*100; } void main( ){ int n; double x, f; x=1001. 0103; func (x, n, f): cout<<"Part 1="<<n<<" , part2="<<f<<end1 }
举一反三
- 以下程序运行后的输出结果是________。 #include "stdio.h" int f(int x); void main() { int n=1,m; m=f(f(f(n))); printf("%d",m); } int f(int x) {return x*2;}: 1/#/2/#/4/#/8
- 下面程序的运行结果是a=____,b=____。#include<;stdio.h>;int main( ){void f( int x , int y ) ;int a = 1 , b = 2 ;f( a , b ) ;printf( "a=%d,b=%d\n" , a , b ) ;return 0 ;}void f( int x , int y ){x = 100 ;y = 200 ;}
- 下列程序的运行结果是______ 。#include void main() { int n=0,m=1,x=2; if(!n) x-=1; if(m) x-=2; if(x) x-=3; printf("%d\n",x); }
- 下列程序的运行结果是 [12] 。 include <iostream. h> class Sample int x,y; public: Sample() x=y=0; Sample(int a, int b) x=a;y=b; void disp() cout<<" x=" <<x<<" , y="<<y<<end1; ; void main() Sample s1, s2(1, 2); s1. disp0; s2. disp ();
- 有以下程序: #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