this is the code i've come up with so far. I figure i can make word equal to the line of the string its reading and loop through going word[i] printing all the chars to the outfile, then put an if statement saying if word[i] = '@' then reverse. Then when it gets to the end of the line go to the next and start all over.
Code:
#include <stack>
#include <iostream>
#include <fstream>
using namespace std;
stack<char> rev;
char tmp;
int counter;
void Reverse()
{
while(word[i] != '@')
{
rev.push(word[i]);
++counter;
}
for(i=1;i<=counter;i++)
{
tmp = rev.top();
outFile << tmp;
rev.pop();
}
}
int main()
{
string inFileName = "reverse.in";
string outFileName = "reverse.out";
ifstream inFile;
ofstream outFile;