The user will input: string1 string2 123, and in my main, I hope to get my variables string str1, string str2, int num get the input data. So after the user input, str1 = string1, str2 = string2, num = 123. I will use cin to read the data, but how to read them one by one? Thank you!
Share
Assuming the strings have no spaces in them, you can simply extract them: