C++ 有用的书籍
Essential C++ 中文版
C++ Primer Plus 第6版中文版
C++ Primer中文版(第5版)
#include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
void select_sort(int *p,int n);
int a[],i;
cout<<"enter the originl array:"<<endl;
for(i=;i<;i++)
cin>>a[i];
cout<<endl; select_sort(a,);
cout<<"the sorted array:"<<endl;
for(i=;i<;i++)
cout<<a[i]<<" ";
cout <<endl;
return ;
} void select_sort(int *p,int n)
{
int i,j,k,t;
for(i=;i<n-;i++)
{
k=i;
for(j=i+;j<n;j++)
if(*(p+j)<*(p+k))k=j;
t=*(p+k);
*(p+k)=*(p+i);
*(p+i)=t;
}
}