这个程序说什么也点发,,你们懂得!

来源:互联网 发布:电脑唱歌录音软件 编辑:程序博客网 时间:2024/05/16 19:34

* Copyright (c) 2012, 烟台大学计算机学院
* All rights reserved.
* 作    者:庄子豪
* 完成日期:2012 年  12月12 日
* 版 本 号:v1.0
*
* 输入描述:
* 问题描述:
* 程序输出:
* 问题分析:
 *算法设计

#include<iostream>using namespace std;void select_sort(int *p,int n);int main(){int a[10],i;cout<<"enter the originl array:"<<endl;for(i=0;i<10;i++){cin>>a[i];}cout<<endl;select_sort(a,10);cout<<"the sorted array:"<<endl;for(i=0;i<10;i++){cout<<a[i]<<" ";}cout<<endl;return 0;}void select_sort(int *p,int n){int i,j,k,t;for(i=0;i<n-1;i++){k=i;for(j=i+1;j<n;j++){if(*(p+j)<*(p+k)){k=j;}}t=*(p+k);*(p+k)=*(p+i);*(p+i)=t;}}


原创粉丝点击