Write a code segment that will read a sentence from the keyboard, terminated with a period '.' and write the sentence to the screen with all white space (blanks, tabs, , replaced by the symbol '*'. Use library a function to carry out the determination of whether the character read is 'white space'. Show any #include files you may need.
What will be an ideal response?
```
#include
#include
using namespace std;
int main()
{
char ch;
do
{
cin.get(ch);
if(isspace(ch))
cout << '*';
else
cout << ch;
} while ('.' != ch);
cout << endl;
return 0;
}
Typical run:
The first line is input, the second is output from the program:
Now is the time for all good men to come to the aid
Now*is*the*time*for*all*good*men*****to*come*to*the*aid
```
You might also like to view...
For the following examples, identify its organizational scheme.
a. Television listing b. Index in a book c. Map of hiking trails d. Calendar of events e. The white pages in a U.S. telephone book f. Art gallery with rooms for each of the medieval, Renaissance, Rococo, Romantic, and Impressionist artists
Survey ten of your fellow students who grew up in the United States. Ask them what each of the following colors means to them:
What will be an ideal response?
Whose primary responsibility is it to test computer programs?
What will be an ideal response?
Tagging blog posts allows users to find information in a linear way
Indicate whether the statement is true or false