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 in (“Input.txt”);

char word[25];

while(in)

{ in>>word;

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

cout<<strrev(word);

else

cout<<word;

}



Discussion

No Comment Found

Related InterviewSolutions