Sunday, 6 May 2012

Program Of Error Handling In C++

#include <iostream.h>
#include<conio.h>
main()

{
    clrscr();

     char FirstName[30], LastName[30];

    int Age;

    char FileName[20];

    cout << "Enter the name of the file you want to open: ";

    cin >> FileName;


    if(Students.bad())    // error handling

    {

    cout<<"\n Error in File";

    }

    Students >> FirstName >> LastName >> Age;

    cout << "\nFirst Name: " << FirstName;

    cout << "\nLast Name:  " << LastName;

    cout << "\nEnter Age:  " << Age;

    cout << "\n\n";


getch();

}


No comments:

Post a Comment