网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下面的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、对一维数组顺序排序” 相关考题
考题 下列给定程序中,函数fun()的功能是;求S的值。设 S=(22/1*30))*(42/(3*5))*(62/(5*7))*…*(2k)2/((2k-1)*(2k+1))例如,当k为10时,函数的值应为1.533852。请改正程序中的错误,使它能得出正确的结果。注童;不要改动main 函数,不得增行或删行,也不得更改程序的结构。试题程序:include <conio. h>include <stdio. h>include <math.h >/**************found***************/fun (int k){ iht n; float s, w, p, q;n=1;s=1.0;while (n<=k){ w=2. 0*n;p=w-1.0;q=w+1.0;s=s*w*w/p/q;n++;}/***************found**************/return s}main(){ clrscr ();printf ("%f\n ", fun (10));}

考题 假定输入的字符串中只包含字母和*号。请编写函数 fun(),它的功能是:将字符串中的前导*号全部删除,中间和后面的*号不删除。例如,若字符串中的内容为****A*BC*DEF*G*******,删除后,字符串中的内容则应当是A*BC*DEF*G*******。注意:部分源程序给出如下。请勿改动主函数main 和其他函数中的任何内容,仅在函数fun 的花括号中填入所编写的若干语句。试题程序;include <stdio. h>include <conio. h>void fun (char *a){}main(){char s[81];printf("Enter a string :\n");gets (s);fun (s);printf ("The string after deleted: \n");puts (s);}

考题 有以下程序:include main( ) {int a[]={1,2,3,4,5,6,7,8,9,10,11,12,},*p=a+5,*q=NUL 有以下程序:#include <stdio. h>main( ) { int a[]={1,2,3,4,5,6,7,8,9,10,11,12,},*p=a+5,*q=NULL; *q=*(p+5); printf("%d%d\n",*p,*q);程序运行后的输出结果是( )。A.运行后报错觉B.6 6C.6 11D.5 10

考题 有以下程序:include main ( ){ inti=0.s=0;for(;;) if( i = = 3 ‖ i = = 5 ) continu 有以下程序: #include <stdio. h> main ( ) { inti=0.s=0; for(;;) if( i = = 3 ‖ i = = 5 ) continue; if (i ==6) break; i++; s+ =i; } printf(" % d \n" ,s);程序运行后的输出结果是( )。A.10B.13C.21D.程序进入列循环

考题 下列给定程序中,函数fun()的功能是:根据整型参数m,计算如下公式的值。y=1/(100×100)+1/(200×200)+1/(300×300)+…+1/(m×m)例如,若m=2000,则应输出0.000160。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <conio.h>include <stdio. h>/*************found**************/fun (int m){ double y=0, d;int i;/*************found**************/for (i=100, i<=m, i+=100){d= (double) i* (double) i;y+=l. 0/d;}return (y);}main ( ){ int n=2000;clrscr();printf("\nThe result is %lf\n",fun(n));

考题 以下C程序段的输出结果是(30)。 include void abc(char *str){ int a, b; 以下C程序段的输出结果是(30)。 #include <stdio. h> void abc(char *str){ int a, b; for(a=b=0;str[a]!='\O';a++)if(str[a]!='c') str[b++]=str[a]; str[b]='\O'; } void main(){ char str[]="abcdef"; abc(str); printf("str[]=%s",str); }A.str[]=aB.str[]=abC.str[]=abdefD.str[]=abcdef

考题 当执行下面的程序时,如果输入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

考题 当执行下面的程序时,如果输入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

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

考题 执行以下程序后,输出号的个数是【】。 include main() {int i, j;for(i=1; i 执行以下程序后,输出号的个数是【 】。include<stdio. h>main(){ int i, j;for(i=1; i<5; i++)for(j=2; j<=i; j++)putchar('');}

考题 有以下程序: include main ( ){char s[] = "ABCD", * p;for(p=s+1;p 有以下程序: #include < stdio. h > main ( ) { char s[] = "ABCD", * p; for(p=s+1;p<s+4;p++) pfintf(" % s \n" ,p); }A.ABCD BCD CD DB.A B CC.B C DD.BCD CD D

考题 有以下程序:include main( ){ unsigned int a; int b=-1;a=b;printf(" % u", a);程序 有以下程序: #include <stdio. h> main( ) { unsigned int a; int b=-1; a=b; printf(" % u", a);程序运行后的输出结果是( )。A.-1B.65535C.32767D.-32768

考题 有以下程序: include difine F(X, Y)(X)*(Y)main(){int a=3, b=4; print("% d\n", 有以下程序: # include<stdio. h> # difine F(X, Y) (X)*(Y) main() { int a=3, b=4; print("% d\n", F(a++, b++)); } 程序运行后的输出结果是______。A.12B.15C.16D.20

考题 有以下程序:include main ( ){char a :'a',b; printf( "% c," , + + a); printf("%c 有以下程序: #include <stdio. h> main ( ) { char a :'a',b; printf( "% c," , + + a); printf("%c \n" ,b =a++); }程序运行后的输出结果是( )。A.b,bB.b,cC.a,bD.a,c

考题 下列程序段的输出结果为()。includemain(){ static char a[]="language";char*p; p=a; 下列程序段的输出结果为( )。#include<stdio. h>main(){ static char a[]="language"; char*p; p=a; for(p=a;p<a+8;p+=2) putchar(*p);}A.languageB.lnugC.有语法错误D.lang

考题 以下程序的输出结果是______。include define FUDGE(y)2.84+ydefine PR(a) printf ( 以下程序的输出结果是______。#include <stdio. h>#define FUDGE(y) 2.84+y#define PR(a) printf ("%d",(int)(a))#define PRINT1(a) PR(a); putchar('\n')main(){ int x=2; PRINT1(FUDGE(5)*x);}A.11B.12C.13D.15

考题 下列程序的输出结果是______。 include main ( ) {int a,b,c=246; a=c/100%9; b=(-1) 下列程序的输出结果是______。 #include <stdio. h> main ( ) { int a,b,c=246; a=c/100%9; b=(-1)(-1); printf ("%d, %d\n", a,b); }A.2,1B.3,2C.4,3D.2,-1

考题 阅读以下程序及对程序功能的描述,其中正确的是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 include fun(char *w ,int 下列程序运行后,输出结果是______。 #include <stdio. h> #include <string. h> fun (char *w ,int n) { char t,*s1,*s2; s1=w; s2=w+n-1; while (s1<s2) { t=*s1++; *s1=*s2--; *s2=t; } } main () { char *p; p="1234567"; fun (p, strlen (p)); puts (p); }A.1234567B.7654321C.1711717D.7177171

考题 有以下程序:include main( ){ehar str[ ] [10] = { "China" ," Beijing" } , * p = 有以下程序: #include < stdio. h > main( ) { ehar str[ ] [10] = { "China" ," Beijing" } , * p = str[o]; printf( "% s \n", p + 10); }程序运行后的输出结果是( )。A.ChinaB.BeijingC.ngD.ing

考题 为完成下面的程序,应在划线处填入的语句是()。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);}

考题 请选出以下程序的输出结果 ______。include sub(x, y, z)int x, y,*z;{*z=y-x:}main() 请选出以下程序的输出结果 ______。#include <stdio. h>sub(x, y, z)int x, y,*z;{*z=y-x:}main(){ int a, b, c; sub 10,5,a);sub(7,a,b);sub(a, b, c); printf("%d,% d,/%d\n", a, b, c);}A.5,2,3B.-5,-12,-7C.-5,-12,-17D.5,-2,-7

考题 有以下程序: include main ( ) int a=3,b=4,c=5,d=2;if(a>b) if(b>c)printf("%d", 有以下程序: #include < stdio. h > main ( ) int a=3,b=4,c=5,d=2; if(a>b) if(b>c)printf("%d",d++ +1); else printf( "% d", + + d + 1 ); printf( "% d \n" ,d); 程序运行后的输出结果是( )。A.2B.3C.43D.44

考题 有以下程序:include int f(int a)return a% 2; }main( )int s[8] = {1,3,5,2,4,6} ,i 有以下程序: #include <stdio. h> int f(int a) return a% 2; } main( ) int s[8] = {1,3,5,2,4,6} ,i,d =0; for (i=0;f(s[i]);i++) d+ =s[i]; prinff( "% d \n", d); 程序运行后的输出的结果是( ).A.9B.11C.19D.21

考题 有如下程序:include main (){FILE*fp1;fp1=fopen ("fl.txt", "w");fprintf(fp1,"abc" 有如下程序:#include <stdio. h>main (){ FILE *fp1; fp1=fopen ("fl.txt", "w"); fprintf(fp1,"abc"); fclose (fp1);}若文本文件f1.txt 中原有内容为:good,则运行以上程序后文件f1.txt 中的内容为( )。A.goodabcB.abedC.abcD.abcgood

考题 有以下程序: include main( ){ int m =3,n =4,x; x= -m++; x=x+8/++n; prinff(" % d 有以下程序: #include <stdio. h > main( ) { int m =3,n =4,x; x= -m++; x=x+8/++n; prinff(" % d \n" ,x); } 程序运行后的输出结果是( )。A.3B.5C.-1D.-2

考题 下面的程序输出的结果是( )。 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

考题 在下面的程序的横线处填上适当的语句,使该程序的输出结果为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