Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

question regarding why we use for loop in the below codes

$
0
0
hi every body. I have question regarding the tracing of these codes and also why we used the for loop.
#include <iostream>  
#include <vector> //include the vector library  
   
 using namespace std;  
 int main()  
 {  
    vector<int>myVector;  

   myVector.push_back(2);  
     myVector.push_back(7);  

     myVector.push_back(7);     //vector<int>mybector;     

    for(int i=0; i<myVector.size(); i++) // to use the size member function. use myVector.size()  

   {  
        cout << myVector[i];  

    } 

 }


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>