Say you have a file formatted like this (name, phone number):
Joe Smith, 9019809923
Greg Jones, 9019867823
and you use getline to read in the each line then push it into a vector of strings.
so, you use
get the line, then push it into the vector like this:
getline(cin, name, ','); //ignore the comma
This pushes Joe Smith into vector(0) and the corresponding phone number into vector(1), and the same with the second name into vector 2 & 3.
Is there any way to 'rip' out the phone numbers and properly format it like this: 901-980-9923?
I do not need help formatting the number... my question is how to you rip out a string and convert it into an integer - to properly use % to get it to format it correctly?
Any help greatly appreciated.