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

崔怡轩工作笔记

[复制链接]

694

主题

1080

帖子

2万

积分

管理员

Rank: 9Rank: 9Rank: 9

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

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

使用道具 举报

694

主题

1080

帖子

2万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
22786
 楼主| 发表于 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;

}




回复

使用道具 举报

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

本版积分规则

小黑屋|东台市机器人学会 ( 苏ICP备2021035350号-1;苏ICP备2021035350号-2;苏ICP备2021035350号-3 )

GMT+8, 2024-4-18 11:54 , Processed in 0.040778 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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