-
#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;}
-
查看答案
正确率:100%
-
2021-03-07 08:46:00
-
请给出下面的程序的输出结果。#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);}
-
查看答案
正确率:100%
-
2021-03-07 08:22:00
-
-
-
-
-
-
-
-