Skip to content

Commit

Permalink
Update 例1.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
GongXiangShun authored Jul 28, 2020
1 parent bb139ef commit f03eafd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//函数模板参数可以是类属参数,也可以包括普通类型的参数
//函数模板参数可以是类属参数,也可以包括普通类型的参数
#include<iostream>
using namespace std;


template <class T>
//实现降序
//实现降序
void sort(T &a, int n){
for (int i=0;i<n;i++){
int p=i;
for (int j=i;j<n;j++)
if(a[p]<a[j])
p=j;
int t=a[i];
T t=a[i];
a[i]=a[p];
a[p]=t;
}
Expand Down

0 comments on commit f03eafd

Please sign in to comment.