You can't store multiple names in one string. Well, you can, but not in the way you're trying to do it. You're trying to use array semantics:
so names has to be an array of some kind, either a static array or something that implements operator  to provide an array-like syntax.
I can't tell you what's wrong with your vector code because you didn't post it.
Also at the above line of code i is undefined. Variables are not automatically initialised to zero when you declare them; if that's what you want, then that's what you must type.
int i; // this is undefined and can AND WILL contain anything. You cannot assume it will contain 0.
int j=0; // this is initialised to zero
printf("%d %d\n",i,j); // try it - see what this displays. It will be a junk value and zero.
Given that the code enforces a limit of 10 names the easiest solution here would be to keep the code as it is, initialise i to zero at the top and make names an array of 10 strings, i.e.
With vectors you have to use push_back() and the like, you cannot extend a vector by using  syntax.
The only way to store multiple names in one string is to concatenate them with a suitable separator, for example
string names="Alan, Bert, Charlie, Denzil";
but that's trickier to extract when you need them; names won't give you "Bert".