Electrical and Computer Engineering
7 of 29
UAH
CPE 112
An Example Program
Using Files
• // Output results
• 
•    outData << setprecision(3);
•    outData << "The surface area is " << surfaceArea << " sq. ft."
•            << endl;
•    outData << "The painting cost for" << endl;
•    outData << "   red is" << setw(8) << redCost << " dollars"
•            << endl;
•    outData << "   blue is" << setw(7) << blueCost << " dollars"
•            << endl;
•    outData << "   green is" << setw(6) << greenCost << " dollars"
•            << endl;
•    return 0;
•}