Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write program that accomplishes the following task.Be sure to use proper top down design techniques and include an appropriate number of functions with an appropriate

Write program that accomplishes the following task.Be sure to use proper top down design techniques and include an appropriate number of functions with an appropriate amount of arguments. (70 points)

If you make any assumptions or interpretations of the prompt that you feel that you need to clarify, be sure to include it as a comment.

  1. Declare an array of size 100. Choose the data type carefully.
  2. Write program that asks the user to enter a number.
  3. Based on the number that the user entered, the program reads that many characters from a file called "words.txt", one character at a time, storing each character in the array. You may download "words.txt" from Files on Canvas; it is essentially just a long list of words.
  4. Print the contents of the array, with the following twist: there should be no spaces between each indexed value, and if the value is a space character the program prints out a new line character instead. Are the parameters call by value or call by reference? Explain as a comment.
  5. Ask the user to enter one more number.
  6. If the actual number itself is found in the array, display the message "number found at index " with the correct index number.
  7. Change the last character of that word into the number as well. Print out the array again.
  8. Otherwise, display the message "number not found".

Requirements:

-For input, the second number MUST be taken by calling a function that does have a return value.

-You may assume that the user always enters valid input; all input will be numbers less than 100, there will be no excess input, etc.

-You may assume that the text file will always only contain characters and spaces.

Example output based on words.txt:

How many characters? 36

Here are the contents:

Hay

is

very

int3resting

becau5e

of

t

What number? 3

Found at index 15

Hay

is

very

int3restin3

becau5e

of

t

Explanation: 36 characters counts up to "t" of "the", spaces included.The first output has a new line for every space.The second output finds the actual number "3" in index 15 which belongs to the word "int3resting", so it changes the last letter "g" into "3" as well.

write this program in c++ please

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_2

Step: 3

blur-text-image_3

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

What policies can promote sustainable trade?

Answered: 1 week ago