满意答案
jackylu99
2013.08.22
采纳率:41% 等级:12
已帮助:7488人
这个是不难的,我一会帮你做,先占个座
#include
#include
#include
using namespace std;
string path;//路径
int n=0;//随机数数目
int num[500];//随机数数组
void random();
void mao(int a[],int b);
void wb();
void main()
{
random();
mao(num,n);
wb();
}
void random()
{
srand((unsigned)time(NULL));
char s1[100];//路径
cout<
cin>>s1;
path=s1;
cout<
cin>>n;
for(int i=0;i
{
num[i]=10000*rand()/(RAND_MAX+1)-5000;
}
ofstream f1(path.c_str());
for(int i=0;i
f1<
}
void mao(int a[],int b)
{
cout<
int i=0;
int j=0;
int h1=0;
bool flag=0;
for(i=0;i
{
flag=0;
for(j=0;j
{
if(a[j+1]
{
h1=a[j];
a[j]=a[j+1];
a[j+1]=h1;
flag=1;
}
}
if(flag==0)
break;
}
}
void wb()
{
ofstream f1(path.c_str());
for(int i=0;i
f1<
}
00分享举报