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.
- Declare an array of size 100. Choose the data type carefully.
- Write program that asks the user to enter a number.
- 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.
- 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.
- Ask the user to enter one more number.
- If the actual number itself is found in the array, display the message "number found at index " with the correct index number.
- Change the last character of that word into the number as well. Print out the array again.
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started