>> it say i have to use vector, and i try but have errors
The errors are because your code is wrong.
>> i can't use getline(cin,names).could anyone tell me why?
Can't use as in you've been told not to, or can't use as in you get errors? If the latter then it's because your code is wrong.