Write a C++ program to display three words related to summer
Answers
Answer:
sorry I don't know this answer
Answer:
Split a sentence into words in C++
Give a sentence, print different words present in it. Words are separated by space.
Examples:
Input : str = "Geeks for Geeks"
Output : Geeks
for
Geeks
Explanation : All space separated words
are printed line by line.
Input : str = "a computer science portal"
Output : a
computer
science
Recommended: Please try your approach on {IDE} first, before moving on to the solution.
Method 1 (Writing our own logic)
We traverse through all characters. If current character is space, we have reached end of a word, we print current word and reset it to empty. Else we append current character to word.
// C++ program to print words in a sentence
#include <bits/stdc++.h>
please mark me as a brainlist