RPN Calcultor

I have been at this for days i need some help finishing it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include <iostream>
#include <cstdlib>
#include <string.h>
#include <stdio.h>
//#include <string>

using namespace std;

class Element;

class Element
{
public:

	double value;
	double elm;
	Element *elm;
	double getvalue();
	void setvalue(double value);
	Element * getnext();
	void setnext(Element *nextelement);
	
	
	Element()
	{
	value =0;
	elm = NULL;
	}

};

static Element* head;

double Element::getvalue()
{
	return value;
}

void Element::setvalue(double newvalue)
{
	value = newvalue;
}

Element* Element::getnext()
{
	return elm;
}

void Element::setnext(Element *nextelement)
{
	elm=nextelement;
}

class Calculator
{
public:

	char operation[100];
	double total;
	int elcount;
	int opcount;
	void getelements();
	void scanelements();
	void calculate();
	void returntotal();
	void pop(Element *elm);
	void push(Element *elm);
};

void Calculator::getelements()
{
	cout<<"Enter operation in suffix format \nSeparate each number or operation with a coma\nEx. 12,30,+ = 12+30\n\n";
	cin>>operation;
}

void Calculator::scanelements()
{
	double number;
	int strlength;
	char *tokenPtr;
	char operationcpy[100];
	strcpy(operationcpy,operation);
	tokenPtr = strtok(operationcpy, ",");
	while(tokenPtr != NULL)
	{
		printf("%s\n",tokenPtr);
		tokenPtr = strtok(NULL, ",");
	}
	
	strlength = Calculator::operation.length();
	while(cin >>operation)
	{
		if (isdigit(operation[0]))
			number=atof(Calculator::operation.c_str());
		else if(operation==".")
			return calculate();
		else
		{
			double number = pop(*elm);
			if(operation == "+")
				push(pop(*elm) + number);
			else if (operation == "-")
				push(pop(*elm) - number);
			else if (operation == "*")
				push(pop(*elm) * number);
			else if (operation == "/")
				push(pop(*elm) / number);
		}
	}
	return pop(*elm);
	}

void pop(Element *elm)
{
	elm=*head;
	head=*head->next;
}

void push(Element *elm)
{
	elm->next=head;
	head=elm;
}

int main(void)
{
	Calculator calc;
	calc.getelements();
	calc.scanelements();
	calc.push(*elm);
	calc.pop(*elm);

	system ("PAUSE");
}


here are the errors i'm getting:

(17) : error C2040: 'Element::elm' : 'Element *' differs in levels of indirection from 'double'
(51) : error C2440: '=' : cannot convert from 'Element *' to 'double'
1> There is no context in which this conversion is possible
(90) : error C2228: left of '.length' must have class/struct/union
1> type is 'char [100]'
(94) : error C2228: left of '.c_str' must have class/struct/union
1> type is 'char [100]'
(99) : error C2065: 'elm' : undeclared identifier
(115) : error C2440: '=' : cannot convert from 'Element' to 'Element *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
(116) : error C2039: 'next' : is not a member of 'Element'
(12) : see declaration of 'Element'
(121) : error C2039: 'next' : is not a member of 'Element'
(12) : see declaration of 'Element'



Thank you for your help :-)
Line 17: You have two members named 'elm':
1
2
double elm;
Element *elm;

Line 51: Should be fixed when line 17 is fixed.
Line 90: C strings (char *) don't have length(). They don't have any members. Only std::string has length().
Line 94: Same as above.
Line 99: elm is a member of Element, not Calculator.
Line 115: Exactly what the error says. Maybe you meant this? *elm=*head;
Line 116: You never declared any member of Element called 'next'.
Line 121: Same as above.
Topic archived. No new replies allowed.