Thursday, March 7, 2013

Filing Using outClientFile Template by Matee Gojra

By Unknown   Posted at  1:33 AM   C++ Programming No comments

 //To Keep Previous Data in File Replace World "out" with "app" in Line#7.
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
int main()
{
    ofstream outClientFile("BSSE.txt", ios::out);
    if(!outClientFile)
    {
         cerr<<"\n\tFile Oppening Error...!"<<endl; //error mxg in Case of File Creating Failed...
    }
    char name[15];
    int rollNo;
    float gpa;
    outClientFile<<"ROLL NO."<<setw(9)<<"NAME"<<setw(11)<<"GPA\n";
    cout<<"\n\t** Enter ^Z to END input **\n";
    cout<<"\n > Enter RoolNo, Name and GPA: ";
    while(cin>>rollNo>>name>>gpa)
    {
        outClientFile<<"   "<<rollNo<<setw(9)<<"    "<<name<<setw(11)<<"  "<<gpa<<endl;
        cout<<"\n > Enter RoolNo, Name and GPA: ";
    }
    cout<<"\n\t\tDONE...!\n";
    system("pause");
}

About the Author

Nulla sagittis convallis arcu. Sed sed nunc. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.
View all posts by: BT9

0 comments:

Back to top ↑
Connect with Us

What they says

© 2013 GC Study Timez. WP Daily Quranand Hadith Converted by Matee Gojra
Blogger templates. Proudly Powered by Blogger.