博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C++ 实用的小程序
阅读量:7218 次
发布时间:2019-06-29

本文共 2017 字,大约阅读时间需要 6 分钟。

 

1. 打开test_ids.txt 将里面的东西添加"1_",然后另存为test_ids_repaired.txt

 

1 #include 
2 #include
3 #include
4 #include
5 #include
6 using namespace std; 7 int main(){ 8 9 ifstream file;10 file.open("/home/wangxiao/Downloads/Link to ASPL---code/features/test_ids.txt");11 ofstream in("/home/wangxiao/Downloads/test_ids_repaired.txt");12 13 std::string line;14 std::string image_id;15 16 while(getline(file, line)){17 std::string add = "1_";18 line = add + line;19 20 image_id = line;21 in<
<

 

 

 

 

2 : 编写一个程序,读入stringint的序列,将每个stringint存入一个pair中,pair保存在一个vector中.

 

1 #include
2 #include
3 #include
4 #include
5 #include
6 #include
7 8 using namespace std; 9 int main(int argc, char *argv[])10 {11 ifstream in(argv[1]);12 if (!in) {13 cout<<”打开输入文件失败!”<
> data;18 string s;19 int v;20 while (in>>s && in>>v)21 data.push_back(pair
(s, v));22 // data.push_back({s, v}); 列表初始化的方式;23 // data.push_back(make_pair(s, v)); 或者使用 make_pair ;24 25 for (const auto &d : data)26 cout<
<<” ---> ”<
<

 

 

3. 打开test_ids.txt 将里面的东西添加"i_",然后另存为test_ids_repaired.txt  从1~88种 ...

1 #include 
2 #include
3 #include
4 #include
5 #include
6 using namespace std; 7 8 int main(){ 9 10 ifstream file;11 file.open("/home/wangxiao/Downloads/ASPL_matlabFiles/test_ids.txt");12 ofstream in("/home/wangxiao/Downloads/ASPL_matlabFiles/outPut_test_ids.txt");13 14 std::string line;15 std::string image_id;16 17 18 for (int i=1;i<89;i++){19 20 for (int j=1;j<52;j++){21 22 getline(file, line);23 stringstream ss;24 string s;25 ss << i;26 ss >> s;27 string add = s + "_";28 image_id = add + line;29 in<
<

 

转载地址:http://qltym.baihongyu.com/

你可能感兴趣的文章
基于AOE网的关键路径的求解
查看>>
2017-5-16 python标准库
查看>>
浅谈游戏的声音处理-流播放文件 source
查看>>
旧版本转换成支持ARC版本
查看>>
创建与服务器的输入输出流
查看>>
string.hのmemmove的实现
查看>>
dicom网络通讯入门(1)
查看>>
日常训练.jpg
查看>>
iOS----KVC和KVO 详解
查看>>
2019寒假训练营第三次作业
查看>>
precision、recall、accuracy的概念
查看>>
PyTorch学习系列(九)——参数_初始化
查看>>
后缀树
查看>>
PowerDesigner执行SQL生成模型
查看>>
软件项目技术点(2)——Canvas之平移translate、旋转rotate、缩放scale
查看>>
软件项目技术点(25)——提升性能之检测绘制范围
查看>>
linux的基本操作1
查看>>
puppeteer 填充基础表单
查看>>
邻接表存储
查看>>
web 常用开发工具
查看>>