Program for WORKING WITH SINGLE FILE

Home Forums C++ Program for WORKING WITH SINGLE FILE

This topic contains 0 replies, has 1 voice, and was last updated by  admin 4 months, 4 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5245

    admin
    Keymaster

    //WORKING WITH SINGLE FILE
    //Creating files with constructor function
    #include<iostream>
    #include<fstream>
    using namespace std;
    int main()
    {
    ofstream outf(“ITEM”);
    cout <<“enter item name: “; char name[30]; cin >>name;
    outf < cout <<“enter item cost :”; float cost; cin >>cost;
    outf <>name;
    inf >>cost;
    cout <<“\n”;
    cout <<“item name : ” << name <<“\n”;
    cout <<“item cost: ” << cost <<“\n”;
    inf.close();
    return 0;
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.