Saturday, April 18, 2015

Vector in C++ simple functions

#include <iostream>
#include <vector>
using namespace std;

int main()
{
vector <string> array;
string ch;
for(int i=0;i<10;i++)
{
cin>>ch;
array.push_back(ch);
}
for (int i = 0; i < array.size(); i++)
{
/* code */
cout<<array[i]<<" ";
}
return 0;
}

No comments:

Post a Comment

Contributors

Translate