1.

Write a function RevText() to read a text file “ Input.txt “ and Print only word starting with ‘I’ in reverse order .Example: If value in text file is: INDIA IS MY COUNTRYOutput will be: AIDNI SI MY COUNTRY

Answer»

void RevText( )

{

ifstream Fin(“Input.txt”);

char Word[20];

while(!Fin.eof())

{

Fin>>Word;

if(Word[0]==’I’)

strrev(Word);

cout<<Word<< “ ”;

}

Fin.close( );

}



Discussion

No Comment Found

Related InterviewSolutions