Question: You are given the following C + + main function:Assuming that the program compiles, use a trace table with headings i , term 1 ,
You are given the following main function:Assuming that the program compiles, use a trace table with headings i term term term nextTerm, and cout to show your working for parts a and ca What is the output of the program if is entered for n marksb Explain what happens when is entered for n marksc What is the output of the program if lines and were interchanged? The value entered for n is marksTotal Marks: a Write a C program to encode a text message found in a file and save the encoded message to a new file. Your program should prompt the user for the following data input:toReplace: The character in the message to be replaced.replacement: The character to replace toReplace.Your program should perform the following tasks:
Read the message from a file named "message.txt
Replace all occurrences of toReplace with replacement in the message.
Output the encoded message to a new file named "encodedMessage. txt
Print to the output screen, the number of characters replaced in the message.
Print to the output screen, the encoded message from "encodedMessage txt
marks
Page
b In a bakery, a fixed percentage of butter is taken from a container each day. Assume that values for and already exist, where:
B is the number of cups of butter in the container at the start of the first day.
is the percentage of butter in the container taken out each day.
Write a snippet of code to print the number of the day, the amount taken for that day, and the amount remaining at the end of the day. The output should be terminated when days have been printed or the amount remaining is less than cups, whichever comes first.
For example, if and the output should start as follows:
Day Amount Taken Amount Remaining
table
marks
Total Marks:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
