scanf vectors blahblah

can you tell me how can I insert more vectors in the same time with scanf
Inline have to be like this :"name:surname:phonenumber"
I have to add n names,surnames,phonenumbers for each i...

something like this but i get an error . help ?
1
2
3
4
5
6
7
8
9
10
vector <string> name,surname,number;
	int n;
	cin>>n;
	name.resize(n);
	surname.resize(n);
	number.resize(n);
	for(i=0;i<n;i++)
	{
		scanf("%s:%s:%s",&name[i],&surname[i],&number[i]);
	}
This works for me. scanf("%s %s %s",&name[i][0],&surname[i][0],&number[i][0]);

Edit: For colon delimited data try scanf("%[^:]:%[^:]:%s",&name[i][0],&surname[i][0],&number[i][0]);
Last edited on
yes it works really but how to printf that ?
Topic archived. No new replies allowed.