![]() |
In C++, we may need to read the input that includes the paragraph of text with spaces. In this article, we will learn how to read a paragraph of text with spaces in C++. Reading a Paragraph in C++To read a paragraph of text that includes spaces, we can use the std::getline() function that can read the whole paragraph until the newline character is encountered which indicates the end of the paragraph. C++ Program to Read a Paragraph of Text with SpacesThe below program demonstrates how we can use the getline() function to read a paragraph of text. C++
Output Enter a paragraph of text: We can also use loops to read multiple paragraphs or continue reading until a specific condition is met. |
Reffered: https://www.geeksforgeeks.org
C++ |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 11 |