191k views
1 vote
Given the availability of an ofstream object named output, write the other statements necessary to write the string "3.14159" into a file called pi. (Do not define a main function.)

User David Lu
by
5.3k points

1 Answer

2 votes

Answer:

The statements are given below:

output.open("pi"); // opening the file by the of stream object

output << "3.14159";

output.close(); // closing the file

Explanation:

In this we open the file with the help of output stream object .The statement output.open("pi"); is opening the file after after opening the file "pi". The output object print the 3.14159 message in console and finally the output stream file is close with the help of output.close() statements .

User Dodjs
by
5.7k points