no idea what to do about this error =/
#include <stack>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
stack<string> stack;
ifstream inFile;
string consoleStr = "Enter Filename>> ";
string fileName;
string word = "";
char c;
cout << "Welcome! Enter filename or quit to exit.\n" << endl;
cout << consoleStr;
cin >> fileName;
while(fileName.compare("quit") != 0) {
cout << "Opening file:\n\n";
inFile.open(fileName.c_str());
if(inFile.is_open()) {
while(!inFile.eof()) {
c = inFile.get();
if(c = 40 ) {
word.append(1,c);
stack.push(word);
}
else if(c = 41) {
if(stack.top()= word) {
stack.pop();
}
if(stack.top() != word) {
cout << " Unmatched () " <<endl;
}
word = "";
}
}
stack.push(word);
word = "";
}
else {
cout << "Could not open file!\n";
}
inFile.close();
inFile.clear();
while(stack.size() != 0) {
stack.pop();
}
cout << consoleStr;
cin >> fileName;
}
return 0;
}
matching.cpp: In function `int main()':
matching.cpp:42: error: could not convert `(+(&stack)->std::stack<_Tp, _Sequence>::top [with _Tp = std::string, _Sequence = std::deque<std::string, std::allocator<std::string> >]())->std::basic_string<_CharT, _Traits, _Alloc>::operator= [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(&word))))' to `bool'