Skip to content

Commit

Permalink
better format
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Nov 20, 2014
1 parent 18b8bb3 commit 3b825e0
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions ch09/ex9_13.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! @Alan
//! @author @shbling @Alan
//!
//! Exercise 9.13:
//! How would you initialize a vector<double> from a list<int>?
Expand All @@ -9,24 +9,26 @@
#include <string>
#include <vector>
#include <list>

using std::list;using std::vector;using std::cout;using std::endl;

int main()
{
list<int> ilst(5, 4);
vector<int> ivc(5, 5);
vector<double> dvc (ilst.begin(),ilst.end());//from list<int> to vector<double>
for (auto i : ilst)
cout << i;
cout << endl;
for (auto t : dvc)
cout << t;
cout << endl;
vector<double> dvc2(ivc.begin(), ivc.end());//from vector<int> to vector<double>
for (auto i : ivc)
cout << i;
cout << endl;
for (auto t : dvc2)
cout << t;
return 0;
{
list<int> ilst(5, 4);
vector<int> ivc(5, 5);

//! from list<int> to vector<double>
vector<double> dvc (ilst.begin(),ilst.end());
for (auto i : ilst) cout << i;
cout << endl;
for (auto t : dvc) cout << t;
cout << endl;

//! from vector<int> to vector<double>
vector<double> dvc2(ivc.begin(), ivc.end());
for (auto i : ivc) cout << i;
cout << endl;
for (auto t : dvc2) cout << t;

return 0;
}

0 comments on commit 3b825e0

Please sign in to comment.