adding provided code

This commit is contained in:
Jidong Xiao
2024-02-15 15:53:44 -05:00
parent 38e759e9a8
commit ab4c4f5aed
2 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#include <iostream>
#include <sstream> // include this so that we can use stringstream
int main(){
std::string longString = "663-979-6253_953-451-3708_410-750-5502_750-260-3152_688-574-6330_915-954-4073";
// create a stringstream to tokenize the long string
std::istringstream iss(longString);
std::string token;
// tokenize the long string using the underscore delimiter
while (std::getline(iss, token, '_')) {
std::cout << token << std::endl;
}
return 0;
}