c++ 传参

#include "stdafx.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <TlHelp32.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
//#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <sstream>
using std::cout;
using std::endl;
#include <vector>
typedef struct difNumStruct
{
int a;
int b;
int c;
}countModify;

void test(int &a,int &b,int &c)
{
cout<<a<<","<<b<<","<<c<<endl;
a = 11;
b = 12;
c = 13;
}

void test2(difNumStruct &t)
{
cout<<t.a<<","<<t.b<<","<<t.c<<endl;
t.a= 44;
t.b = 55;
t.c = 66;
}
void test3(std::vector<std::pair<int, std::string>> infoVector)
{
cout<<">>>>>>>>>>>>>>"<<endl;
std::vector<std::pair<int, std::string> >::iterator itr = infoVector.begin();
for(;itr!=infoVector.end();itr++)
{
std::pair< int, std::string > authorTmp = *itr;
cout << authorTmp.first<<","<<authorTmp.second<< endl;
}
}


int _tmain(int argc, _TCHAR* argv[])
{
Rerun:
cout<<">>>>>>>>>>"<<endl;
/*int a = 1;
int b = 2;
int c = 3;
test(a,b,c);
cout<<a<<","<<b<<","<<c<<endl;
*/

/*difNumStruct d;
d.a = 3;
d.b = 4;
d.c = 5;
test2(d);
cout<<d.a<<","<<d.b<<","<<d.c<<endl;
*/
std::pair< int, std::string > author(2,"aaaaaaaaa");
cout << author.first<<","<<author.second<< endl;

std::vector<std::pair<int, std::string>> infoVec; //其他修改容器
std::pair< int, std::string > author1(30,"bbb");
std::pair< int, std::string > author2(5,"ccc");
std::pair< int, std::string > author3(7,"dd");
infoVec.push_back(author1);
infoVec.push_back(author2);
infoVec.push_back(author3);
cout<<"<<<<<<<<<<"<<endl;
test3(infoVec);
/*std::vector<std::pair<int, std::string> >::iterator itr =infoVec.begin();
for(;itr!=infoVec.end();itr++)
{
std::pair< int, std::string > authorTmp = *itr;
cout << authorTmp.first<<","<<authorTmp.second<< endl;
}*/
/*std::ostringstream oss;
std::string str="";
int a = 123456789;
oss<<a;
str +=oss.str();
cout<<str<<endl;
*/

// PROCESSENTRY32 pl[100];
// int pc;
// HANDLE hProcessSnap = NULL;
// PROCESSENTRY32 pe32 = {0};
// if (argc != 2)
// {
// cout<<"Usage\n\t ThisProgram processId"<<endl;
// return 0;
// }
// kill(4660,9);
// cout<<"kill process end"<<endl;

// ShellExecuteEx();

system("pause");
// return EXIT_SUCCESS;


// int *a = new int[1024];
// Sleep(1000);
// goto Rerun;


return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值