没注释的源代码
#include <iostream>
using namespace std;
void sort(char *p,int m);
int main()
{
int n;
char *p,num[100];
cout<<"please input n:";
cin>>n;
cout<<"please input these numbers:"<<endl;
for(int i=0;i<n;i++)
{
cin>>num[i];
}
p=&num[0];
sort(p,n);
cout<<"now the sequence is:"<<endl;
for(int i=0;i<n;i++)
{
cout<<num[i]<<" ";
}
cout<<endl;
return 0;
}
void sort(char *p,int m)
{
char temp,*p1,*p2;
for(int i=0;i<m/2;i++)
{
p1=p+i;
p2=p+(m-1-i);
temp=*p1;
*p1=*p2;
*p2=temp;
}
}