From 5e743c720c0de92a7a2dbae352707f2cb736ab0e Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Thu, 15 Feb 2024 15:56:35 -0500 Subject: [PATCH] token to phone number --- hws/05_online_dating/README.md | 6 +++--- hws/05_online_dating/provided_code/test.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hws/05_online_dating/README.md b/hws/05_online_dating/README.md index 53fc0e5..aa25397 100644 --- a/hws/05_online_dating/README.md +++ b/hws/05_online_dating/README.md @@ -224,11 +224,11 @@ 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; + std::string phoneNumber; // tokenize the long string using the underscore delimiter - while (std::getline(iss, token, '_')) { - std::cout << token << std::endl; + while (std::getline(iss, phoneNumber, '_')) { + std::cout << phoneNumber << std::endl; } return 0; } diff --git a/hws/05_online_dating/provided_code/test.cpp b/hws/05_online_dating/provided_code/test.cpp index 8831041..25bb491 100644 --- a/hws/05_online_dating/provided_code/test.cpp +++ b/hws/05_online_dating/provided_code/test.cpp @@ -6,11 +6,11 @@ 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; + std::string phoneNumber; // tokenize the long string using the underscore delimiter - while (std::getline(iss, token, '_')) { - std::cout << token << std::endl; + while (std::getline(iss, phoneNumber, '_')) { + std::cout << phoneNumber << std::endl; } return 0; }