Assignment 2-B: Text Analysis Collapse context Write a C++ program that reads a file named words.txt and counts and prints the total number of words, the total number of VISIBLE characters (with white...



C++


Assignment 2-B: Text<br>Analysis<br>Collapse context<br>Write a C++ program that reads a file named<br>words.txt and counts and prints the total number of<br>words, the total number of VISIBLE characters (with<br>white spaces), the total number of VISIBLE characters<br>(without white spaces), the number of white spaces,<br>and the number of lines in the file.<br>1/0<br>Program Input:<br>One text file called

Extracted text: Assignment 2-B: Text Analysis Collapse context Write a C++ program that reads a file named words.txt and counts and prints the total number of words, the total number of VISIBLE characters (with white spaces), the total number of VISIBLE characters (without white spaces), the number of white spaces, and the number of lines in the file. 1/0 Program Input: One text file called "words.txt" Program Output: Multiple lines showing the total number of words, the total number of characters (with white spaces), the total number of characters (without white spaces), the number of white spaces, and the number of lines in the file, THIS PART HAS BEEN ALREADY WRITTEN FOR YOU. Sample Testcase 0: (To try on your computer, it won't be graded, there is another secret text). Input: Suppose words.txt has the following passage: Arithmetic operators in C++ have the same precedence as they do in mathematics. Multiplication and division have left associativity (meaning that they will be evaluated from left to right) and they have higher precedence than addition and subtraction, which also have left associativity. We can also force the precedence of expression using parentheses. Just the same way as you would do that in normal mathematics. Output: Number of characters without spaces: 351 Number of characters with spaces: 409 Number of words: 65 Number of lines: 7 Spaces count: 58

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here