From 2456fa27f6fe448ea229deb7422cbd656663f20e Mon Sep 17 00:00:00 2001 From: AdithyakrishnaV Date: Fri, 24 Sep 2021 14:12:36 +0530 Subject: [PATCH] print each word of sentence in new line --- each_word_print.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 each_word_print.cpp diff --git a/each_word_print.cpp b/each_word_print.cpp new file mode 100644 index 0000000..fd32b18 --- /dev/null +++ b/each_word_print.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +using namespace std; + +int main(){ + string sentence="Hi I'm Adi welcome to my repo"; + + istringstream aa(sentence); + string reader; + + while(getline(aa, reader, ' ')){ + cout<< reader << endl; + } + + return 0; +} \ No newline at end of file