崔怡轩工作笔记
1.信息学奥赛理论知识43页。2.一个物联网的项目。
3.查询关于esp32的功能,介绍,并且发表一篇帖子总结一下。
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
//创建二维数组分别存储int及string数据
string str;
int I = {0};
ifstream myfile("data1.txt");
ofstream outfile("out.txt", ios::trunc);
if (!myfile.is_open())
{
cout << "can not open this file" << endl;
return 0;
}
//从data1文件中读入int数据
for (int i = 0; i < 25; i++)
{
for (int j = 0; j < 2; j++)
{
myfile >> I;
}
}
//读入string数据
for (int i = 25; i < 50; i++)
{
for (int j = 0; j < 4; j++)
{
myfile >> str;
}
}
//将数据输出至out.txt文件中
for (int i = 0; i < 25; i++)
{
outfile<< I << " " << I << " "
<< str << " " << str << " "
<< str << " " << str<< endl;
};
myfile.close();
outfile.close();
return 0;
}
页:
[1]