troubleshooting Question

Compile Error

Avatar of Chris Pfeiffer
Chris PfeifferFlag for Japan asked on
2 Comments1 Solution651 ViewsLast Modified:
I am sure this is easy, I am trying to explore C++ using random websites and can not figure out why this will not compile.

I get the compile error at error C2660: 'SubExpression::parse' : function does not take 1 arrgument.

Thanks in advance

I have included subexpression as well
#include <iostream>
#include <fstream>
#include <strstream>
#include <string>
#include <vector>
using namespace std;

#include "expression.h"
#include "subexpression.h"
#include "symboltable.h"
#include "parse.h"

SymbolTable symbolTable;

void parseAssignments(strstream& in);

int main()
    const int SIZE = 256;
    Expression* expression;
    char paren, comma, line[SIZE];
    string program;

    ifstream fin("input.txt");
    while (true)
        fin.getline(line, SIZE);
        if (!fin)
        strstream in(line, SIZE);
        in >> paren;
        cout << line << " ";
            expression = SubExpression::parse(in); 
            in >> comma;  
            double result = expression->evaluate();
            cout << "Value = " << result << endl;    
        catch (exception& e)
              cout << "Standard exception: " << e.what() << endl;
    return 0;

void parseAssignments(strstream& in)
    char assignop, delimiter;
    string variable;
    double value;
        variable = parseName();
        in >> ws >> assignop >> value >> delimiter;
        symbolTable.insert(variable, value);
    while (delimiter == ',');
#include <iostream>
using namespace std;

#include "expression.h"
#include "subexpression.h"
#include "operand.h"
#include "plus.h"
#include "minus.h"
#include "times.h"
#include "divide.h"

SubExpression::SubExpression(Expression* left, Expression* right)
    this->left = left;
    this->right = right;

Expression* SubExpression::parse()
    Expression* left;
    Expression* right;
    char operation, paren;
    left = Operand::parse();
    cin >> operation;
    right = Operand::parse();
    cin >> paren;
    switch (operation)
        case '+':
            return new Plus(left, right);
        case '-':
            return new Minus(left, right);
        case '*':
            return new Times(left, right);
        case '/':
            return new Divide(left, right);
    return 0;
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros