Question: Can someone help with this c++ Write a function fileLoadWrite that opens a file and writes to it the squares of the numbers 1-10, each

Can someone help with this c++

Can someone help with this c++ Write a function fileLoadWrite that opens a file and writes to it the squares of the numbers 1-10,

each on its own line. The function takes one parameter, the name

of the file filename. It should open the file in write mode

Write a function fileLoadWrite that opens a file and writes to it the squares of the numbers 1-10, each on its own line. The function takes one parameter, the name of the file filename. It should open the file in write mode and write 10 lines to the file, each containing the square of the number line it is on (e.g. line 1 will contain 1, line 2 will contain 4, etc.). The function should close the file and return O if the file was opened successfully else it should return -1 An example of a function call to fileLoaderWrite is fileLoadwrite("myFile.txt") which should successfully open a new file called myFile.txt and write ten lines of squared numbers. Note: If a file called myFile.txt is already associated to a stream then the open(...) method fails

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 Databases Questions!