Reputation: 2828
I have this code so far:
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <string>
#include <stack>
using namespace std;
int main () {
ifstream in;
in.open("example.txt");
ofstream outfile;
outfile.open("out.txt");
stack<string> lines;
string temp;
while(getline(in, temp))
lines.push(temp);
while(!lines.empty())
outfile << lines.pop() << endl;
in.close();
outfile.close();
return 0;
}
My question is, why did i get a compile error of "no match for operator << in outfile".
Upvotes: 1
Views: 1838