用函数的返回值做容器构造函数的参数

来源:互联网 发布:怎么成为淘宝店铺客服 编辑:程序博客网 时间:2024/05/17 04:31

庭博网校QQ:14280784    86974558

学习内容和顺序:

1、C语言;

2、C++语言;

3、VC++;

4、win32编程;

5、数据库编程;

6、网络编程;

7、多线程编程。

初中毕业一年3500元、高中毕业一年3000元、大专以上一年2500元。每天20:00到22:00上课

 

/*
功能:用函数的返回值做容器构造函数的参数
*/
#include "stdafx.h"
#include "vector"
#include "string"
#include "iostream"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
 string get_str(string ss);
 int get_int(int name);

 vector<string> sv(get_int(33),get_str("www"));
 //vector<string> sv(get_str("www"));//没有这样的vector<string>构造函数。
 vector<string>::iterator j;
 for(j=sv.begin();j!=sv.end();j++)
  cout<<*j<<" ";
 cout<<endl;

 getchar();
 return 0;
}
int get_int(const int name)
{
 return name;
}
string get_str(string ss)
{
 return ss;
}

 

原创粉丝点击