here is the question: "write a program , which has as content "time is a great teacher but unfortunately it kills all its pupils"
and outputs th reverse string to the disk file out.txt.
My problem is that im stuck with the part on how to display the sentence in reverse anyone to help me with the codes?
Codes:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char a[100];
ofstream f("out.txt");
f<<"time is a great teacher but unfortunately it kills all its pupils ";
f.close();
ifstream f1("out.txt");
char ch;
while(f1.get(ch)){
ch--;
cout <<ch;
}
f1.close();
return 0;
}