功能
用到的觀念
CODE
#include<iostream>//header file
#include<iomanip>
#include<cmath>
using namespace std;
using std::setw;
using std::fixed;
using std::setprecision;
#include<string>
using std::string;
using std::getline;
int hcf(int, int);
int main()
{
int a[]={3,8,10,30,2,16,27,13,22,17,42,33,38,29,14},t;
for(int l=0;l<15;l++)
{
for(int i=0;i<15;i++)
{
if(*(a+i+1)<*(a+i))
{
t=*(a+i+1);
*(a+i+1)=*(a+i);
*(a+i)=t;
}
}
}
for(int j=0;j<15;j++)
{
cout<<*(a+j)<<"<";
if(j==14)
cout<<*(a+14);
}
system("pause");
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.7.59