void main is a glaring error.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
cin>>"function";
int num = 0;
what do you mean by this ==>cin>>"function";
muze
Junior Poster in Training
62 posts since Sep 2010
Reputation Points: 10
Solved Threads: 3
main() should have return type int.
In main() you want to read the file with the ifstream you declared, not with cin. Therefore replace cin with the ifstream in lines 26-35.
In addition push, pop and serve are member functions of a class and can only be called using an object of the desired class so someplace you are going to have to declare objects of the appropriate class(es) to call the appropriate methods/functions.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
First thing first
1) cin>>function is the right way to use, taking input in some variable
2) This cant be used to get data from the file.
3) As pointed out by Lerner, most of the functions are member functions and you did not call them using appropriate objects.
muze
Junior Poster in Training
62 posts since Sep 2010
Reputation Points: 10
Solved Threads: 3
how would I appropriately call them using objects then? I don't remember how to do so.
You need a good book to start with. Try to go directly on OOP basics, it will most probably be 6th or 7th chapter of any random book.
Lets suppose there is a class of name Shape, further suppose it has a function names Square like this.
class Shape{
public:
Shape(); //constructor
Square();
}
Now in the main(), you call it by the object of Shape like this
Shape sh;
sh.Square();
This is how you use an object to call its member function. If this is not a copied assignment, leave this code and refer to your book as soon as possible.
muze
Junior Poster in Training
62 posts since Sep 2010
Reputation Points: 10
Solved Threads: 3