← Quiz: Strings in C++: all 10 questions
Quiz: Strings in C++ · Question 6 of 10
Which call splits "a;b;c" into its parts?
Which call splits "a;b;c" into its parts?
- A.ss >> part with stringstream ss("a;b;c")
- B.getline(ss, part, ';') in a loop
- C.s.substr(';')
- D.s.find(';', true)
Answer & explanation
Correct answer: getline(ss, part, ';') in a loop
getline with a delimiter reads up to each ';'. The >> operator only splits at whitespace.
Can you get the rest right without peeking?
Take the timed Quiz: Strings in C++ quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →