vector——ing
来源:互联网 发布:英轩重工怎么样知乎 编辑:程序博客网 时间:2024/05/08 08:40
//h.h
#pragma once
#include <iostream>
#include <vector>
#include <string>
#include <conio.h>
#include <atlstr.h>//CString
using namespace std;
typedef struct {
int i;
string str;
CString Cstr;
}node;
template <typename T>
void PushMyVector(vector<T> &str)
{
T word;
cout<<"now man input"<<endl;
cin>>word;
cout<<endl;
str.push_back(word);
//word = "auto input value";
//cout<<"now auto input:"<<word<<endl;
//str.push_back(word);
//T word2= "auto input2";
//str.push_back(word2);
}
template <typename T>
void PrintMyVector(vector<T> &str)
{
vector<T>::iterator it_vs;
cout<<"now print"<<endl;
for (it_vs= str.begin() ;it_vs != str.end(); it_vs++)
{
cout<<*it_vs<<endl;
}
}
//void PushMyVector(vector<int> &myInt)
//{
// int word;
// cout<<"now man input"<<endl;
// cin>>word;
// cout<<endl;
// myInt.push_back(word);
// word = 16890;
// cout<<"now auto input:"<<word<<endl;
// myInt.push_back(word);
// int word2= 123456;
// myInt.push_back(word2);
//}
//void PrintMyVector(vector<int> &myInt)
//{
// vector<int>::iterator it_vs;
// cout<<"now print"<<endl;
// for (it_vs= myInt.begin() ;it_vs != myInt.end(); it_vs++)
// {
// cout<<*it_vs<<endl;
// }
//}
void PushMyVector(vector<node> &myInt)
{
CString Str="CString";
node word;
cout<<"now man input"<<endl;
cin>>word.i;
cin>>word.str;
cin>>word.Cstr.GetBuffer();
cout<<endl;
myInt.push_back(word);
word.i=234;
word.str =Str.GetBuffer();
word.Cstr="cstringdf no new";
cout<<"now auto input:"<<word.i<<" "<<word.str<<" "<<word.Cstr<<endl;
myInt.push_back(word);
node word2={1234334,"asasdf","cstringdf"};
myInt.push_back(word2);
}
void PrintMyVector(vector<node>& myInt)
{
vector<node>::iterator it_vs;
cout<<"now print"<<endl;
for (it_vs= myInt.begin() ;it_vs != myInt.end(); it_vs++)
{
cout<<(*it_vs).i<<" "<<(*it_vs).str<<" "<<(*it_vs).Cstr.GetBuffer()<<endl;
}
}
//t1.cpp
#include <iostream>
#include <vector>
#include <string>
#include <conio.h>
#include <atlstr.h>//CString
#include "h.h"
using namespace std;
void main()
{
vector<string> myStr;
PushMyVector(myStr);
PrintMyVector(myStr);
vector<int> myInt;
PushMyVector(myInt);
PrintMyVector(myInt);
vector<node> myStruct;
PushMyVector(myStruct);
PrintMyVector(myStruct);
getch();
}
- vector——ing
- Android —— 日常Error(ing)
- ing
- ing
- ACM——划水ing——背包讨论
- 初心修炼 ing——再论沟通
- lucene3.0学习ing——建立索引
- 图论相关问题——持续更新ing
- 《编程ING》——打开神秘魔法世界的大门
- python进阶ing——创建第一个Tornado应用
- 夏令营面试经验——反思总结(更新ing)
- Tiny6410学习ing—文件编辑(库函数访问文件)
- android studio问题集锦二—更新ing
- Tiny6410学习ing—(一)、嵌…
- Notes—Dense Vector and Sparse Vector
- STL — — vector
- STL——vector
- STL——vector
- 重构
- 《程序员》杂志试读:Web开发人员的利器:Ruby on Rails
- Java操作Word,Excel,Access,Outlook
- 后算法时代
- 寒假读书计划!
- vector——ing
- 求助 加油机的发展历程??
- 不要用别人的错误惩罚自己
- 淡泊以明志,宁静而致远
- 伟人和凡人之间的差别
- ASP.NET操作Word文档
- 40种网站设计常用技巧
- JavaScript图片上传前预览和限制图片格式
- Popup Calculator (弹出计算器)