2.随机生成10个10到100000的数,转成字符串并输出到文件
#include <iostream>
#include<fstream>
#include<string>
#include<ctime>
using namespace std;
int main(){
srand((int)time(NULL));
int num;
ofstream outfile ("11.txt");
if(!outfile.is_open()){
cout<<"erro"<<endl;
}else{
for(int i=0;i<10;i++){
num = 10+rand()%99990;
outfile<<std::to_string(num)<<" ,";
}
}
outfile.close();
return 0;
}