高等继续教育 / 面向对象程序设计
正确率:100%
【面向对象程序设计】模拟试题
请给出下面的程序的输出结果。#include <iostream.h>templatevoid sort(T*a,int n){Tnum;for(int i=0;i<N-1;i++){for(int j=i;j<N-1;j++)if(a[j]>a[j+1]){num=a[j];a[j]=a[j+1];a[j+1]=num;}}for(i=0;i<N;I++)cout<<A[I];cout<<endl;}void main( ){int iver[5]={12,45,9,23,37}; double dver[5]={22.3,56.7,43.5,13.8,8.6};sort(iver,5); sort(dver,.5);}
考题内容:
请给出下面的程序的输出结果。#include <iostream.h>templatevoid sort(T*a,int n){Tnum;for(int i=0;i<N-1;i++){for(int j=i;j<N-1;j++)if(a[j]>a[j+1]){num=a[j];a[j]=a[j+1];a[j+1]=num;}}for(i=0;i<N;I++)cout<<A[I];cout<<endl;}void main( ){int iver[5]={12,45,9,23,37}; double dver[5]={22.3,56.7,43.5,13.8,8.6};sort(iver,5); sort(dver,.5);}
请给出下面的程序的输出结果。#include <iostream.h>templatevoid sort(T*a,int n){Tnum;for(int i=0;i<N-1;i++){for(int j=i;j<N-1;j++)if(a[j]>a[j+1]){num=a[j];a[j]=a[j+1];a[j+1]=num;}}for(i=0;i<N;I++)cout<<A[I];cout<<endl;}void main( ){int iver[5]={12,45,9,23,37}; double dver[5]={22.3,56.7,43.5,13.8,8.6};sort(iver,5); sort(dver,.5);}
考题内容:
请给出下面的程序的输出结果。#include <iostream.h>templatevoid sort(T*a,int n){Tnum;for(int i=0;i<N-1;i++){for(int j=i;j<N-1;j++)if(a[j]>a[j+1]){num=a[j];a[j]=a[j+1];a[j+1]=num;}}for(i=0;i<N;I++)cout<<A[I];cout<<endl;}void main( ){int iver[5]={12,45,9,23,37}; double dver[5]={22.3,56.7,43.5,13.8,8.6};sort(iver,5); sort(dver,.5);}
参考答案: