disk042 - endl << "in a disk file. When...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// filename: disk042.cpp // author: j. dzuback // modified: // date: 09/30/09 / /* **************************************** The program accesses a file located on a disk-like media. The user enters the path and file name information which the program repackages and delivers (back) to the operating system (Windows). **************************************** */ #include <iostream> #include <iomanip> #include <fstream> #include <string> # using namespace std; u int main() { char dish; int calorys; string fileNameOut; ofstream mealOut; cout << endl << "Enter the file name with extension & press enter: "; cin >> fileNameOut; mealOut.open(fileNameOut.c_str()); cout << endl << endl << "The program will store the calories from a meal" <<
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: endl << "in a disk file. When prompted, enter a letter for the dish" << endl << "and the calories, separated by a space" << endl << endl; cout << "Enter M and the calories for the meat: "; cin >> dish >> calorys; mealOut << dish << " " << calorys << endl; cout << "Enter V and the calories for the vegetable: "; cin >> dish >> calorys; mealOut << dish << " " << calorys << endl; cout << "Enter D and the calories for the dessert: "; cin >> dish >> calorys; mealOut << dish << " " << calorys << endl; mealOut.close(); cout << endl << endl << "End of program **** disk042.cpp ****" << endl; return 0; } // end of main }...
View Full Document

This note was uploaded on 02/08/2011 for the course CSC 101 taught by Professor Joedzuback during the Spring '11 term at Union County.

Ask a homework question - tutors are online