Monday, 30 January 2012

Program Of File Write Opreation In C++


#include<iostream.h>
#include<conio.h>
#include<fstream.h>
main()
{
    clrscr();
    char FirstName[30], LastName[30];
    int Age;
    char FileName[20];

    cin >> FirstName;
    cout << "Enter Last Name:  ";
    cin >> LastName;
    cout << "Enter Age:        ";
    cin >> Age;
    cin >> FileName;
    ofstream Students(FileName,ios::out /*ios::app*/);
    Students << FirstName << "\n" << LastName << "\n" << Age;
    getch();

}

No comments:

Post a Comment