Write and test a program that reads the content of the file word by word, convert...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write and test a program that reads the content of the file word by word, convert each word to plural form and print it back to the user in reverse order. . Develop the following function: string readWords(string file name, int& size): This function should read the file given by file name word by word, save the words into an array of strings an return it to the called, the function need to open the file twice, one to count the number of words and the other time is to read them into the dynamic array. Develop the following function: string change to plural (string word); Use the following rules: O O O Complete the following main: int main() { if noun ends in "y" remove the "y" and add "ies" if noun ends in "s" or "sh" add "es" all other cases just add "s" //TODO 1: declare all required variables //TODO 2: read all the words in the file input.txt into a dynamic array using the readWords function. //TODO 3: print the words in plural form to the user in reverse order //TODO 4: free any dynamic memory } For the following input file: input.txt chair diary boss circus fly dog clue dish Your program should print: dishes clues dogs flies circuses bosses diaries chairs. Write and test a program that reads the content of the file word by word, convert each word to plural form and print it back to the user in reverse order. . Develop the following function: string readWords(string file name, int& size): This function should read the file given by file name word by word, save the words into an array of strings an return it to the called, the function need to open the file twice, one to count the number of words and the other time is to read them into the dynamic array. Develop the following function: string change to plural (string word); Use the following rules: O O O Complete the following main: int main() { if noun ends in "y" remove the "y" and add "ies" if noun ends in "s" or "sh" add "es" all other cases just add "s" //TODO 1: declare all required variables //TODO 2: read all the words in the file input.txt into a dynamic array using the readWords function. //TODO 3: print the words in plural form to the user in reverse order //TODO 4: free any dynamic memory } For the following input file: input.txt chair diary boss circus fly dog clue dish Your program should print: dishes clues dogs flies circuses bosses diaries chairs.
Expert Answer:
Answer rating: 100% (QA)
Heres a C program that accomplishes the task you described include include include using namespace s... View the full answer
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these programming questions
-
A company has a $36 million portfolio with a beta of 1.2. The futures price for a contract on an index is 900. Futures contracts on $250 times the index can be traded. What trade is necessary to...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In Exercises show that is strictly monotonic on the given interval and therefore has an inverse function on that interval. f(x) = cos x, [0, ]
-
A flat sheet of ice has a thickness of 2.0 cm. It is on top of a flat sheet of crystalline quartz that has a thickness of 1.1 cm. Light strikes the ice perpendicularly and travels through it and then...
-
A force ' \(F\) ' is to be transmitted through a square threaded power screw into a nut. If ' \(t\) ' is the height of the nut and ' \(d\) ' is the minor diameter, then which one of the following is...
-
Measurement criteria are more important than disclosure requirements for small entities. Discuss.
-
On January 1, 2014, VB Technical Inc. issues a 5-year, 6% fixed-rate interest only, nonprepayable $5,000,000 note with interest payable on June 30 and December 31 of each year. VB decides to change...
-
(1 point) 3sin(x)tan(x)+3 sin(x)=0 Find all angles in radians that satisfy the equation. For each solution enter first the angle solution in [0,) or [0,2) (depending on the trigonometric function)...
-
Remove the CUSTOMERREP role from the account created in Assignment 1.
-
A machine costing $58,125 with a 5-year life and $3,500 residual value was purchased January 2. Compute depreciation for each of the five years, using the double-declining-balance method. Year...
-
What are the differences between a breach of contract and a negligence cause of action?
-
The 1971 Statement of Responsibilities of Internal Auditors states that internal auditing: a. "... may also deal with matters of an operating nature." b. Provides for "the review of accounting,...
-
What goals should be accomplished during a witness interview? What are the question-asking techniques you can use to accomplish these goals? Give an example of each.
-
What are the linear forecast and hockey stick forecast mistakes, and why would they be common among inexperienced entrepreneurs?
-
The purposes of the Standards for tJie Professional Practice of Internal Auditing are to: a. Unify internal auditing throughout the world. b. Promote the recognition of internal auditing as a...
-
This assessment measures your ability to determine the application of different group models. Social workers are often called upon to lead groups. One of the most important preparations a social wo...
-
A Alkynes can be made by dehydrohalogenation of vinylic halides in a reaction that is essentially an E2 process. In studying the stereochemistry of this elimination, it was found that...
-
Answer the following question about this MATLAB function: I get the output x = 0.3333 after one iteration, which is not the correct answer. What is required to fix this code? 1 2 3 4 5 6 7 8 function...
-
Consider the solution to the diffusion equation on a 4 4 rectangular grid with equal spacing in the x and y directions. The boundary conditions for the problem are Using the global index k and the...
-
What mathematical problem is solved by the following MATLAB code? 1 function x = problem3_8 2 itmax = 100; tol = 0;, x0 = 1; 3 for k=1:itmax 4 5 6 8 9 x=x-f (x)/fprime (x); r=f(x); if abs (r)
-
October 20X1, Little Raven plc issued 50,000 debentures, with a par value of 100 each, to investors at 80 each.The debentures are redeemable at par on 30 September 20X6 and have a coupon rate of 6%,...
-
On 1 October year 1, RPS plc issued one million 1 5% redeemable preference shares. The shares were issued at a discount of 50,000 and are due to be redeemed on 30 September Year 5. Dividends are paid...
-
(a) Who are considered to be the potential users of financial reports? (b) What do you consider to be their information needs? (c) How would you expect a consideration of user needs to influence...
Study smarter with the SolutionInn App