找回密码
 中文实名注册
搜索
查看: 1540|回复: 1

崔怡轩工作笔记

[复制链接]

725

主题

586

回帖

3万

积分

管理员

积分
31638
发表于 2021-8-21 11:10:19 | 显示全部楼层 |阅读模式
1.信息学奥赛理论知识43页。
2.一个物联网的项目。

3.查询关于esp32的功能,介绍,并且发表一篇帖子总结一下。
回复

使用道具 举报

725

主题

586

回帖

3万

积分

管理员

积分
31638
 楼主| 发表于 2021-8-21 14:11:21 | 显示全部楼层
[C++] 纯文本查看 复制代码
#include <iostream>

#include <fstream>

#include <string>

 

using namespace std;

 

int main()

{

    //创建二维数组分别存储int及string数据

	string str[25][4];

	int I[25][2] = {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[i][j];

		}

	}

    //读入string数据

	for (int i = 25; i < 50; i++)

	{

		for (int j = 0; j < 4; j++)

		{

			myfile >> str[i-25][j];

		}

	}

    //将数据输出至out.txt文件中

	for (int i = 0; i < 25; i++)

	{

		outfile  << I[i][0] << "    " << I[i][1] << "    " 

            << str[i][0] << "    " << str[i][1] << "    "

			<< str[i][2] << "    " << str[i][3]<< endl;

	};

 

	myfile.close();

	outfile.close();

	return 0;

}




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 中文实名注册

本版积分规则

快速回复 返回顶部 返回列表