#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<string> v;
string s;
int i;
int j;
int n;
cin >> n;
for( i = 0 ; i < n ; i++ ) {
getline(cin,s);
v.push_back(s);
}
return 0;
}
// above code takes n-1 strings(lines) from the user instead of n.i dont know what is wrong with the code.
Last edited on
std::cin.ignore(1,'\n');
after cin >>n;
.