在以下的代码中,我们将写入一个double数组到1.txt中,并且读取出来。
主要采用了fstream这个库,代码如下:
#include <math.h>
#include <fstream>
#include <iostream>
int main(){
const int length = 100;
double f1[length] ;
for (int i = 0; i < length; i++)
{
f1[i] = i + i / 1000.0;
}
std::ofstream ofs("1