Page 1 of 1

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

Posted: Wed Apr 27, 2022 3:12 pm
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 (39.85 KiB) Viewed 40 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. o The length is and the width is o The area is Apply the close() function on the object to close the file.