Advertisement
Guest User

Untitled

a guest
May 19th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include "stdafx.h"
  2. using namespace std;
  3.  
  4. int _tmain(int argc, _TCHAR* argv[])
  5. {
  6. vector<int> vector1;
  7. vector<int>::iterator vector1;
  8.  
  9.  
  10.  
  11. for( int i=0; i < 10; i++ ) vector1.push_back(i);
  12. int total = 0;
  13.     vector1 = vector1.begin();
  14.     while( vector1 != vector1.end() ) {
  15.       total += *vector1;
  16.       ++vector1;
  17. }
  18.  
  19.     cout << "Total=" << total << endl;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement