当前位置:网站首页>/*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;
}
边栏推荐
- Latex learning insertion number - list of filled dots, bars, numbers
- Four characteristics and isolation levels of database transactions
- leetcode1-3
- 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
- Legion is a network penetration tool
- DDL statement of MySQL Foundation
- MPLS: multi protocol label switching
- leetcode729. My schedule 1
- How to teach yourself to learn programming
- Ruby时间格式转换strftime毫秒匹配格式
猜你喜欢
183 sets of free resume templates to help everyone find a good job
Collection of practical string functions
If you don't know these four caching modes, dare you say you understand caching?
DML statement of MySQL Foundation
Evolution from monomer architecture to microservice architecture
How can Huawei online match improve the success rate of player matching
From programmers to large-scale distributed architects, where are you (2)
Delayed message center design
Basic principle of servlet and application of common API methods
BGP ---- border gateway routing protocol ----- basic experiment
随机推荐
【OpenCV 例程200篇】218. 多行倾斜文字水印
RHCE - day one
Tables in the thesis of latex learning
Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
Work order management system OTRs
Hlk-w801wifi connection
Recursion and divide and conquer strategy
What is devsecops? Definitions, processes, frameworks and best practices for 2022
Latex insert picture, insert formula
Latex arranges single column table pictures in double column format articles
Es entry series - 6 document relevance and sorting
Devop basic command
Advanced technology management - how to design and follow up the performance of students at different levels
VLAN part of switching technology
【Day2】 convolutional-neural-networks
Development guidance document of CMDB
使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
Check 15 developer tools of Alibaba
AUTOSAR from getting started to mastering 100 lectures (106) - SOA in domain controllers
Introduction to tree and binary tree