error while creating vector<char>

I am getting error in this code
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<char> a(1000);
cin>>a;
a.erase(a.begin()+2);
cout<<a;
return 0;
}
is it wrong to treat vector<char> a(1000) as a string?
Error->no known conversion for argument 1 from ‘std::vector<char>’ to ‘std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}’
You are creating a vector of characters. You'll have to extract your 'strings' character-by-character.

I would just use std::string if you want to deal with strings.
thanks...i got it
Topic archived. No new replies allowed.