{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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" <<
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern