单选题下面的C程序完成的功能是()。 #include #defineSIZE5 voidfunc(intdata[SIZE]); main() { inti,buf[SIZE]; printf(""Pleaseinput%dnumbers:"",SIZE); for(i=0;idata[j+1]) { d=data[j]; data[j]=data[j+1]; data[j+1]=d; } }A对一维数组降序排序B对一维数组升序排序C对一维数组逆向排序D对一维数组顺序排序

单选题
下面的C程序完成的功能是()。 #include #defineSIZE5 voidfunc(intdata[SIZE]); main() { inti,buf[SIZE]; printf(""Pleaseinput%dnumbers:"",SIZE); for(i=0;idata[j+1]) { d=data[j]; data[j]=data[j+1]; data[j+1]=d; } }
A

对一维数组降序排序

B

对一维数组升序排序

C

对一维数组逆向排序

D

对一维数组顺序排序


参考解析

解析: 暂无解析

相关考题:

● 下面的一段C 程序中,循环体语句 (59) 退出循环。unsigned char size;int aa;size = 100;while (size-- = 0) {aa += size;}A. 执行100次后B. 执行101次后C. 执行99次后D. 死循环,不会

使用VC6打开考生文件夹下的工程test34_3。此工程包含一个test34_3.cpp,其中定义了表示栈的类stack。源程序中stack类的定义并不完整,请按要求完成下列操作,将程序补充完整。(1)定义类stack的私有数据成员sp和size,它们分别为整型的指针和变量,其中sP指向存放栈的数据元素的数组,size为栈中存放最后一个元素的下标值。请在注释“//**1**”之后添加适当的语句。(2)完成类stack的构造函数,该函数首先从动态存储空间分配含有100个元素的int型数组,并把该数组的首元素地址赋给指针sp,然后将该数组的所有元素赋值为0,并将size赋值为-1(size等于-1表示栈为空)。请在注释“//**2**”之后添加适当的语句。(3)完成类stack的成员函数push的定义。该函数将传入的整型参数x压入栈中,即在size小于数组的最大下标情况下, size自加1,再给x赋值。请在注释“//**3**”之后添加适当的语句。(4)完成类stack的成员函数pop的定义,该函数返回栈顶元素的值,即在size不等于-1的情况下,返回数组中下标为size的元素的值,并将size减1。请在注释“//**4**”之后添加适当的语句。程序输出结果如下:the top elem:1the pop elem:1the stack is empty注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。源程序文件test34_3.cpp清单如下:include<iostream.h>class stack{//** 1 **public:stack ( );bool empty(){return size==-1;}bool full() {return size==99;}void push(int x);void pop();void top();};stack::stack(){//** 2 **for(int i=0; i<100; i++)*(sp+i)=0;size=-1;}void stack::push(int x){//** 3 **cout<<"the stack is full"<<end1;else{size++;*(sp+size) = x;}}void stack::pop(){//** 4 **cout<<"the stack is empty"<<end1;else{cout<<"the pop elem:"<<*(sp+size)<<end1;size--;}}void stack::top(){if iempty() )cout<<"the stack is empty"<<end1;else{cout<<"the top elem:"<<*(sp+size)<<end1;}}void main ( ){stack s;s.push(1);s.top();s.pop();s.top();}

下列程序段的输出结果是( )。 intdata=0; chark='a',p='f' data=p-k; System.out.printlln(data);A.0B.aC.fD.5

有如下程序:includeusing namespace std;classA{public:virtua1 voidfunc1(){cout 有如下程序: #include<iostream> using namespace std; classA{ public: virtua1 voidfunc1(){cout<<“A1”;} voidfunc2(){cout<<“A2”;}}; class B:publicA{ public: void funcl(){cout<<“B1”;} void func2(){cout<<“B2”;}}; intmain(){ A*p=neA.B1B2B.A1A2C.B1A2D.A1B2

有以下程序: include include usingnamespacestd; intmain() {intarrays 有以下程序: #include <iostream> #include <cstdlib> using namespace std; int main() { int arraysize; int *array; cout<<"Please input the size of the array:"; cin>>arraySiZe; array=new int[arraysize]; if(array==NULL) { cout<<"allocate Error\n"; exit(1); } for(int i=0;i<arraysize;i++) array[i]=i*i; int j; cout<<"which element you want to check:"; cin>>j; cout<<array[j]<<end1; return 0; } 执行程序输入:10<空格>5,则输出结果为( )。A.allocate ErrorB.1C.0D.25

下面程序的运行结果是( )。include define SlZE 12 main() {char s[SIZE];int i;for(i=0 下面程序的运行结果是( )。include<stdio.h>define SlZE 12main(){char s[SIZE];int i;for(i=0;i<SIZE;i++) s[i]='A'+i+32;sub(s,5,SIZE-1);for(i=0;i<SIZE;i++)printf("%c",s[i]);printf("\n");}sub(char *a,int t1,int t2){ char ch;while(t1<t2){ ch=*(a+t1);*(a+t1)=*(a+t2);*(a+t2)=ch;t1++;t2--;}}

阅读以下说明和C++程序,将应填(n)处的字句写在对应栏内。[说明]设计一程序,输入10个整数到一个数组中,调整这10个数在数组中的位置,使得其中最小的一个数成为数组的首元素,最大的一个数成为数组的末元素。[C++程序]include <iostream.h>define SIZE 10void main ( ){int data [SIZE];int m;cout<<"请输入"<<SIZE<<"个整数:";for ( m=0;m<SIZE; m++ ) (1);int j=0,k=0;for ( int i=1;i<SIZE; i++ )if ((2)) j=i;else if ( data[i]<data[k] ) (3);if (j>0 ) {int d=data[0];(4);data[k]=d;}if ( k<SIZE-1 ){int d=data [SIZE- 1 ];data[SIZE- 1 ]=data[j];(5);}cout<<end1<<" 排序后: ";for ( m=0;m<SIZE; m++ ) cout<<data[m]<<" " ;}

下面程序运行时输出结果为【】。 include include class Rect { public: Rec 下面程序运行时输出结果为【 】。include<iostream.h>include<malloc.h>class Rect{public:Rect(int1,int w)(length=1;width=w;)void Print(){cout<<"Area:"<<length *width<<endl;)void *operator new(size-t size){return malloc(size);}void operator delete(void *p){free(p)private:int length,width;};void main(){Rect*p;p=new Rect(5,4);p->Print();delete p;}

当执行下面的程序时,如果输入ABC,输出结果是 ______。includeincludevoi 当执行下面的程序时,如果输入ABC,输出结果是 ______。 #include<iostream.h> #include<string.h> void main(){ char ss[10]=“XYZWV”; cin>>ss; strcat(ss,”DEFG”); cout<<ss; }A.ABCDEFGB.ABCEFC.XYZVO/ABCXD.ABCXYZWVD

阅读以下程序,此程序的功能是【】。 include void main() { intn, i, j; for(i=100;i 阅读以下程序,此程序的功能是【 】。include<iostream.h>void main(){int n, i, j;for(i=100;i<999; i+100)for(j=i/100:j<=99;j=j+10){n=i+j;cout<<" "<<n;}cout<<"\n";}

当执行下面的程序时,如果输入ABC,则输出结果是 ( ) include include 当执行下面的程序时,如果输入ABC,则输出结果是 ( ) # include<stdio.h> # include<string.h> main( ) { char ss [10] ="12345"; gets(ss);strcat(ss"6789");printf("%s\n",ss); }A.ABC6789B.ABC67C.12345ABC6D.ABC456789

为完成下面的程序,应在划线处填入的语句是includeusingnamespace std;class Base{pri 为完成下面的程序,应在划线处填入的语句是 #include<iostream> using namespace std; class Base { private: int x; public: Base (int i) { x=i; } ~Base(){} }; class Derived:public Base { public: ______________//完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }A.Derived(int i):Base(i){}B.Derived(){}C.void Derived (int i):Base(i){}D.Derived(int i){Base(i);}

根据下面的主程序,完成类的一种构造函数的最简单形式。 include class base { privat 根据下面的主程序,完成类的一种构造函数的最简单形式。include<iostream.h>class base{private:int num;public:______;};void main( ){base try(6);}

下面程序编译时发现ma[3]=9错误,其原因是______。 include class FunArray { int*pa; 下面程序编译时发现ma[3]=9错误,其原因是______。include<iostream.h>class FunArray{int*pa; //指向一个数组空问int size; //数组元素个数public:FunArray(int a[],int thesize):pa(a),size(thesize){}int Size( ){return size;}}};void main( ){int s[]={3,7,2,1,5,4};FunArray ma(s,sizeof(s)/sizeof(int));ma[3]=9;cout<<ma[3]<<endl;}

有以下程序: include include using namespace std; int main () {char ch[] 有以下程序:include <fstream>include <string>using namespace std;int main (){char ch[] = "The end";ofstream outstr( "d:\\put.txt", ios_base: :app);for (int i = 0; i < strlen( ch ); i++ )outstr.put(ch[i]);outstr.close();return 0;}程序实现的功能是【 】。

有如下的程序: include using namespace std; class AT{friend ostream operato 有如下的程序:include<iostream>using namespace std;class AT{friend ostream operator<<(ostream,AT);}at;ostream operator<<(ostream os,AT){return os<<'@';}int main(){cout<<"MyHome"<<at<<"isHere.com";}执行上面的程序将输出

阅读以下程序及对程序功能的描述,其中正确的是includemain(){FILE*in,*out;charch,inf 阅读以下程序及对程序功能的描述,其中正确的是 #include<stdio.h> main() { FILE*in,*out; charch,infile[10],outfile[10]; printf("Enter the infile name:\n"); scanf("%s",infile); printf("Enter the outfile name:\n"); scanf("%s",outfile); if((in=foen(infileA.程序完成将磁盘文件的信息在屏幕上显示的功能B.程序完成将两个磁盘文件合二为一的功能C.程序完成将一个磁盘文件复制到另一个磁盘文件中D.程序完成将两个磁盘文件合并并在屏幕上输出

有下列程序: include using namespace std; class Stack { public: Stack(unsigned 有下列程序: #include<iosteram.h> using namespace std; class Stack { public: Stack(unsignedn=10):size(n){rep_=new int [size];top=O;} Stack(Stacks):size(s.size) { rep_=new int[size]; foA.4,3,2,1,B.4,3,6,7,2,1,C.4,3,6,2,1,D.1,2,3,4,

为完成下面的程序,应在划线处填入的语句是()。includeusingnamespacestd;classBase{pr 为完成下面的程序,应在划线处填入的语句是( )。 #include <iostream> using namespace std; class Base { private: int x; public: Base(int i) { x=i; } ~Base(){} }; class Derived : public Base { public: _______________ //完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }A.Derived(int i):Base(i){}B.Derived(){}C.voidDerived(int i):Base(0){}D.Derived(int i){Base(i);}

下面的一段C程序中,循环体语句______退出循环。 unsigned char size; int aa; size=100; while (size-->=0) { aa +=size; }A.执行100次后B.执行101次后C.执行99次后D.死循环,不会

下面的程序输出的结果是( )。 include using namespace std; void main(){ 下面的程序输出的结果是( )。 #include <iostream> using namespace std; void main(){ int a=2; int c=a; a++; cout<<c; }A.2B.3C.4D.*a

下面的程序运行后输出为()。include include main(){int a,b;float c;b = 5; 下面的程序运行后输出为( )。 #include <stdio.h> # include <math.h> main() { int a,b; float c; b = 5;c = 6;c = b+7;b = c+1; a = sqrt((double)b+c); printf("%d,%f,%d",a+6,C,b); }A.11.000000,12.0000000,13.000000B.11.000000,12.000000,13C.11.0000000,12,13D.11,12.000000,13

以下程序的执行结果为()。includeclass myClass{Dublic:myClass(intdata) ;myClass( 以下程序的执行结果为( )。 #include<iostream.h> class myClass { Dublic: myClass(int data) ; myClass(){value=0; }; myClass(myClass obj); void print(){ cout<<value<<end1; } ~myClass(){} private: int value; }; myClass::myClass(int data) {value=data; } myClass::myClass(myClass Obj) { value=obj.value; } void main() { myClass a(100); myClass b(a) ; b.print(); }A.0B.100C.10D.程序编译时出错

在下面的程序的横线处填上适当的语句,使该程序的输出结果为12。include using namespac 在下面的程序的横线处填上适当的语句,使该程序的输出结果为12。include<iostream>using namespace std;class TestClass{public:int a,b;TestClass(int i,int j){a=i;b=j;}};class TestCla

在下面横线上填上适当的语句,完成程序。include using namespace std; class Base { in 在下面横线上填上适当的语句,完成程序。include<iostream>using namespace std;class Base{int x;public:Base(int i){x=i;}~Base(){});class Derived:public Base{public:______//完成类Derive构造函数的定义};iht main(){Derived obj

下面的C程序完成的功能是()。 #include #defineSIZE5 voidfunc(intdata[SIZE]); main() { inti,buf[SIZE]; printf(""Pleaseinput%dnumbers:"",SIZE); for(i=0;idata[j+1]) { d=data[j]; data[j]=data[j+1]; data[j+1]=d; } }A、对一维数组降序排序B、对一维数组升序排序C、对一维数组逆向排序D、对一维数组顺序排序

下列程序执行后的输出结果是() voidfunc1(inti); voidfunc2(inti); charst[]="hello,friend!"; voidfunc1(inti) {printf("%c",st[i]); if(i3){i+=2;func2(i);} } voidfunc2(inti) {printf("%c",st[i]); if(i3){i+=2;func1(i);} } main() {inti=0;func1(i);printf("/n");}A、helloB、helC、hloD、hlm