3、泡立ち順BubbleSort()
916 ワード
//
#include
#include
#include
#include
#include
using namespace std;
const int MAXSIZE=501;// ,r[0] , r[1]---r[500]
// BubbleSort()
void BubbleSort(int r[],int n)
{
int exchange=n;
int bound=0;
int temp=0;//
while(exchange!=0)
{
bound=exchange;
exchange=0;
for(int i=1;ir[i+1])//
{
temp=r[i+1];
r[i+1]=r[i];
r[i]=temp;
exchange=i;//
} //
}
}
// data.txt
void read_data(int data[])
{
ifstream infile("data_salary.txt",ios::in);
if(!infile)
{
cerr<>data[i];
infile.close();
}
// ordered_data_salary.txt
void write_data(int data[])
{
ofstream outfile("ordered_data_salary.txt",ios::out);
if(!outfile)
{
cerr<