おまいら!今日からC言語を学んでいくぞー!
■ このスレッドは過去ログ倉庫に格納されています
0089デフォルトの名無しさん
2005/09/24(土) 22:14:03#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
const char *filename="number.txt";
int iNumber[100], NumMax=0;
void CreateNumberFile()
{
int articles=rand()%100+1;
ofstream fout(filename);
for (int i=0 ; i<articles ; i++)
fout << rand()%65535 << endl;
fout.close();
}
void ReadNumberFile()
{
char tmp[80];
int i=0;
ifstream fin(filename);
while (!fin.eof())
{
fin >> tmp;
sscanf(tmp, "%d", &iNumber[NumMax++]);
}
NumMax--;
fin.close();
}
■ このスレッドは過去ログ倉庫に格納されています