Write a complete C++ program to calculate the area of a rectangle and write the answer in the .txt file. Create the .txt

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Write a complete C++ program to calculate the area of a rectangle and write the answer in the .txt file. Create the .txt

Post by answerhappygod »

Write A Complete C Program To Calculate The Area Of A Rectangle And Write The Answer In The Txt File Create The Txt 1
Write A Complete C Program To Calculate The Area Of A Rectangle And Write The Answer In The Txt File Create The Txt 1 (71.76 KiB) Viewed 45 times
Write a complete C++ program to calculate the area of a rectangle and write the answer in the .txt file. Create the .txt file using your name. The program should have the following functions: 1) main() function (16 marks) Ask the user to enter the integer value of length and width. Then, calculate the area using the user-defined function that can calculate the area based on length and width given by the user. Create the .txt file by naming that file based on your name; i.e. yourname.txt Use the if statement to check whether file creation failed. - Write the message ""File not created!" to print on the console if the file was not created. - Use an else statement to state what to do if the file was created. Write "File created successfully!" to print on the console if the file was created. Write this statement in the yourname.txt file that you created. • The length is and the width is • The area is Apply the close() function on the object to close the file. 2) User-defined function (4 marks) Create a user-defined function called the value of length and width. Calculate the area based on the value of length and width. Return the value of an area.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply