Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide a runnable source code to the follwing problem: Use C++ language 3) Well-formed documents (http://wals.info/feature/description/3) Write a program that reads characters of a

Please provide a runnable source code to the follwing problem: Use C++ languageimage text in transcribed

3) Well-formed documents (http://wals.info/feature/description/3) Write a program that reads characters of a document from standard input until the EOF is reached counting the number of a. consonants, b. vowels c. opening and closing parentheses (( and'), d. opening and closing brackets', and ']' ), e. opening and closing braces (, and'y' ), f. whitespace (spaces, tabs, newlines, etc.) g. and everything not one of the above After reading all input, determine if your document is a well-formed by inspecting the ratio of consonants to vowels (calculated simply by dividing the number of consonants by the number of vowels, using floating-point division of course). A well-formed document has a ratio greater than or equal to the well-formed document threshold, which is 2% (the exact value isn't the important point, adjust as necessary) Display to standard output for each of the character groups above their ratio to the total number of non- whitespace characters, and the consonants to vowels ratio. (8 ratios in all) Display a message indicating the document is well-formed or not well-formed Make two runs. Use your source code file (wellFormedDoc.cpp for example) as the input of your first run, and the "Function Overloading & Default Arguments.txt" file provided as the input of your second run. You should redirect these files to standard input at the command line Hint: Use the functions from , std::isspace() for example, where helpful. Use a switch statement with case label fall through where helpful An example output might look like this Document is well-formed with the following statistics: Consonants to total non-whitespace characters ratio: 7909/13923 (0.568053) Vowels Parentheses to total non-whitespace characters ratio: 242/13923 (0.0173813) Brackets Braces Whitespace to total non-whitespace characters ratio: 7433/27846 (0.266932) Other Consonantsto Vowels to total non-whitespace characters ratio: 4861/13923 (0.349135) (0.00186741) to total non-whitespace characters ratio: 2/1071 to total non-whitespace characters ratio: 115/27846 (0.00412986) to total non-whitespace characters ratio: 1655/27846 (0.059434) ratio: 7909/4861 (1.62703) 3) Well-formed documents (http://wals.info/feature/description/3) Write a program that reads characters of a document from standard input until the EOF is reached counting the number of a. consonants, b. vowels c. opening and closing parentheses (( and'), d. opening and closing brackets', and ']' ), e. opening and closing braces (, and'y' ), f. whitespace (spaces, tabs, newlines, etc.) g. and everything not one of the above After reading all input, determine if your document is a well-formed by inspecting the ratio of consonants to vowels (calculated simply by dividing the number of consonants by the number of vowels, using floating-point division of course). A well-formed document has a ratio greater than or equal to the well-formed document threshold, which is 2% (the exact value isn't the important point, adjust as necessary) Display to standard output for each of the character groups above their ratio to the total number of non- whitespace characters, and the consonants to vowels ratio. (8 ratios in all) Display a message indicating the document is well-formed or not well-formed Make two runs. Use your source code file (wellFormedDoc.cpp for example) as the input of your first run, and the "Function Overloading & Default Arguments.txt" file provided as the input of your second run. You should redirect these files to standard input at the command line Hint: Use the functions from , std::isspace() for example, where helpful. Use a switch statement with case label fall through where helpful An example output might look like this Document is well-formed with the following statistics: Consonants to total non-whitespace characters ratio: 7909/13923 (0.568053) Vowels Parentheses to total non-whitespace characters ratio: 242/13923 (0.0173813) Brackets Braces Whitespace to total non-whitespace characters ratio: 7433/27846 (0.266932) Other Consonantsto Vowels to total non-whitespace characters ratio: 4861/13923 (0.349135) (0.00186741) to total non-whitespace characters ratio: 2/1071 to total non-whitespace characters ratio: 115/27846 (0.00412986) to total non-whitespace characters ratio: 1655/27846 (0.059434) ratio: 7909/4861 (1.62703)

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

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

8. Design office space to facilitate interaction between employees.

Answered: 1 week ago