Given an ofstream object named output, associate it with a file named yearsummary.txt for output in a way that truncates (erases) any existing data in the file.

LANGUAGE: C++

CHALLENGE:

Given an ofstream object named output, associate it with a file named yearsummary.txt for output in a way that truncates (erases) any existing data in the file.

SOLUTION:



output.open("yearsummary.txt",ios::trunc);