当前位置:网站首页>/*Write a function to open the file for input, read the contents of the file into the vector container of string class 8.9: type, and store each line as an element of the container object*/
/*Write a function to open the file for input, read the contents of the file into the vector container of string class 8.9: type, and store each line as an element of the container object*/
2022-07-04 10:26:00 【qq_ fifty-eight million seven hundred and thirty-six thousand t】
#include<fstream>
void fun()
{
string str; vector<string>strs;
while (cin >> str)
strs.push_back(str);
std::ofstream in;
in.open("test.txt");
for (vector<string>::iterator it = strs.begin(); it != strs.end(); it++)
in << *it<<endl;
}
int main(void)
{
fun();
return 0;
}
边栏推荐
- system design
- IPv6 comprehensive experiment
- 有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?
- Today's sleep quality record 78 points
- Custom type: structure, enumeration, union
- Doris / Clickhouse / Hudi, a phased summary in June
- Exercise 9-4 finding books (20 points)
- System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
- Native div has editing ability
- 2020-03-28
猜你喜欢

Sword finger offer 05 (implemented in C language)

A little feeling

MPLS: multi protocol label switching

2. Data type

Architecture introduction

The bamboo shadow sweeps the steps, the dust does not move, and the moon passes through the marsh without trace -- in-depth understanding of the pointer

Hands on deep learning (III) -- Torch Operation (sorting out documents in detail)

From programmers to large-scale distributed architects, where are you (I)

If the uniapp is less than 1000, it will be displayed according to the original number. If the number exceeds 1000, it will be converted into 10w+ 1.3k+ display

Two way process republication + routing policy
随机推荐
Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)
今日睡眠质量记录78分
Collection of practical string functions
Talk about scalability
【Day2】 convolutional-neural-networks
什么是 DevSecOps?2022 年的定义、流程、框架和最佳实践
Press the button wizard to learn how to fight monsters - identify the map, run the map, enter the gang and identify NPC
Realsense d435 d435i d415 depth camera obtains RGB map, left and right infrared camera map, depth map and IMU data under ROS
DDL statement of MySQL Foundation
Rhcsa day 10 operation
Does any teacher know how to inherit richsourcefunction custom reading Mysql to do increment?
Introduction to tree and binary tree
Exercise 8-7 string sorting (20 points)
Use the data to tell you where is the most difficult province for the college entrance examination!
leetcode1-3
Differences among opencv versions
按键精灵打怪学习-识别所在地图、跑图、进入帮派识别NPC
Reprint: summation formula of proportional series and its derivation process
Dos:disk operating system, including core startup program and command program
Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?