首页 > 其他 > 详细

exercises 3.16,3.17

时间:2015-04-17 17:52:28      阅读:66      评论:0      收藏:0      [点我收藏+]
 1 #include <iostream>
 2 #include <string>
 3 #include <vector>
 4 using std::string;
 5 using std::vector;
 6 using namespace std;
 7 void bline();
 8 
 9 int main()
10 {
11     //3.16
12     vector<int> v1;
13     vector<int> v2(10);
14     vector<int> v3(10,42);
15     vector<int> v4{10};
16     vector<int> v5{10,42};
17     vector<string> v6{10};
18     vector<string> v7{10,"hi"};
19     
20     bline();
21     cout<<v2.size()<<endl;
22     for(int &i : v2)cout<<i<<endl;
23     bline();
24     cout<<v3.size()<<endl;
25     for(int &i : v3)cout<<i<<endl;
26     bline();
27     cout<<v4.size()<<endl;
28     for(int &i : v4)cout<<i<<endl;
29     bline();
30     cout<<v5.size()<<endl;
31     for(int &i : v5)cout<<i<<endl;
32     bline();
33     cout<<v6.size()<<endl;
34     for(string &i : v6)cout<<i<<endl;
35     bline();
36     cout<<v7.size()<<endl;
37     for(string &i : v7)cout<<i<<endl;
38     bline();
39     //3.17
40     string temp;
41     vector<string> word;
42     while(cin>>temp){
43         for(char &c:temp)c=toupper(c);
44         word.push_back(temp);
45     }
46     for(string tmp:word)cout<<tmp<<endl;
47     
48     return 0;
49 }
50 
51 void bline(){
52     cout<<"------"<<endl;
53 }

 

exercises 3.16,3.17

原文:http://www.cnblogs.com/austuode/p/4435224.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!