Wednesday, May 16, 2012

Prog-1


#include <fstream.h>

#include <iostream.h>

#include <string.h>

#include <conio.h>



int main()

{

       

    char name[10][20];

        char temp[20];

    char ifilename[15],ofilename[15];

        int num;

        int i=0;

        cout<<"Enter how many person details you want to enter"<<endl;

        cin>>num;



        cout<<"Enter the file name where it has to be written \n ";

        cin>>ofilename;

       

        ofstream ofileobj(ofilename,ios::out);

        cout<<"Enter person details ";

        while(i<num)

        {

               

                cin>>name[i];

                ofileobj<<name[i]<<endl;

                i++;



        }

        ofileobj.close();

        cout<<"Eneter the file name where output has to be written \n ";

        cin>>ifilename;

        ifstream inobj(ofilename,ios::in);

        ofileobj.open(ifilename,ios::out);



        cout<<"The details of the person in reverse that are entered is"<<endl;

       

        while(inobj >> temp != NULL)

        {

               

                cout<<strrev(temp)<<endl;

                ofileobj<<temp<<endl;



        }



    getch();

    return 0;

}

No comments:

Post a Comment