高等继续教育 / 面向对象程序设计
正确率:100%
【面向对象程序设计】模拟试题
#include<iostream.h>template<CLASS&NBSP;T>void f(T *a,int n){ int k; T t; for (int i=0;i<N-1;I++){ k=i; for (int j=i+1;j<n;j++) if(a[k]>a[j]) k=j; t=a[i];a[i]=a[k];a[k]=t;}};void main(){ double d[5]={12.3,4.5,-23.4,-90.4,0}; char a[5]={'B','F','A','X','E'}; f(a,5); f(d,5); for (int i=0;i<5;i++) cout<<D[i]<<" "<<A[i]<<endl;}
考题内容:
#include<iostream.h>template<CLASS&NBSP;T>void f(T *a,int n){ int k; T t; for (int i=0;i<N-1;I++){ k=i; for (int j=i+1;j<n;j++) if(a[k]>a[j]) k=j; t=a[i];a[i]=a[k];a[k]=t;}};void main(){ double d[5]={12.3,4.5,-23.4,-90.4,0}; char a[5]={'B','F','A','X','E'}; f(a,5); f(d,5); for (int i=0;i<5;i++) cout<<D[i]<<" "<<A[i]<<endl;}
#include<iostream.h>template<CLASS&NBSP;T>void f(T *a,int n){ int k; T t; for (int i=0;i<N-1;I++){ k=i; for (int j=i+1;j<n;j++) if(a[k]>a[j]) k=j; t=a[i];a[i]=a[k];a[k]=t;}};void main(){ double d[5]={12.3,4.5,-23.4,-90.4,0}; char a[5]={'B','F','A','X','E'}; f(a,5); f(d,5); for (int i=0;i<5;i++) cout<<D[i]<<" "<<A[i]<<endl;}
考题内容:
#include<iostream.h>template<CLASS&NBSP;T>void f(T *a,int n){ int k; T t; for (int i=0;i<N-1;I++){ k=i; for (int j=i+1;j<n;j++) if(a[k]>a[j]) k=j; t=a[i];a[i]=a[k];a[k]=t;}};void main(){ double d[5]={12.3,4.5,-23.4,-90.4,0}; char a[5]={'B','F','A','X','E'}; f(a,5); f(d,5); for (int i=0;i<5;i++) cout<<D[i]<<" "<<A[i]<<endl;}
参考答案:
佳题速递: