Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++, Write a program that replaces punctuation with whitespace, i.e., a space, as follows: consider punctuation characters as (dot) (comma), '? (question mark),(dash), (single

Using C++,

image text in transcribed

image text in transcribedimage text in transcribed

Write a program that replaces punctuation with whitespace, i.e., a space, as follows: consider punctuation characters as "(dot) (comma), '?" (question mark),(dash)," (single quote), you must not modify any characters within a pair of double quotes (including the double-quotes), and, you will need to disable the skipping of whitespace (on input) to make this program work properly, e.g., see https://en.cppreference.com/w/cpp/io/manip/skipws (but there are also other ways this can be done) You program must process all input from standard input (i.e., std:cin) and write all output to standard output (i.e., std:cout) Clarifications & Tips Based on student feedback from the above here are some clarifications, tips, etc. to help do this assignment In this assignment, do not use 's ispunct() or the ispunct() found within the C++Standard Library. Simply hard-code the checks for punctuation in your code. If a opening double-quotation character is not closed, then everything it output to the screen to the end-of-file/error condition, i.e., don't worry that the quotation mark is not closed. Do not convert double-quotation characters to whitespace #include using namespace std; int main() bool is_within_double_quotes - false; // Use all but one of these "METHOD"s and delete the rest... #1f METHOD-1 // skipws using I0 manipulator noskipws... char byte; while (cin >> noskipws >> byte) #elif METHOD 2 skipws by turning off all skipping of whitespace for cin cin.unsetf(ios_base::skipws); char byte; while (cin >> byte) #else // skipws using unformatted input... // NOTE: Using a char here is important if one wants to write cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

3642341780, 978-3642341786

More Books

Students also viewed these Databases questions