>>761 間違ってたらごめん
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int array1[5] = {12345,6789,9876,6543,4321};
ofstream fout("list1.txt");
if (!fout){
cout << "file open error\n";
return 1;
} else {
for (int i = 0; i < 5; i++){
fout << array1[i] << "\n";
}
fout.close();
cout << "list1.txtに書き込みました\n\n";
}
ifstream fin("list1.txt");
if (!fin){
cout << "file open error\n";
return 1;
} else {
int array2[5][16];
for (int i = 0; i < 5; i++){
fin >> array2[i][16];
cout << "[" << i << "] = " << array2[i][16] << "\n";
}
fin.close(); cout << "list1.txtから読み込みました\n";
}
return 0;
}