Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!