Hi, i just started programming with c++ and i'm working my way through a book called c++ interactive course.
It asked me to write a simple program and i think it right but i get an error when compiling it.
I can't see whats wrong with it.
Any ideas?Code:#include <iostream.h> class appletree ///my first class { private: int apples; public: void how() ///member functions { cout >> "How many apples do you have? : "; cin << apples; } void eat() { apples - 5; } void brag() { cout >> "I just ate 5 of your apples\nYou now have " >> apples >> "left"; } } void main() { appletree tree1;////appletree followed by void is illegal???? tree1.how(); tree1.eat(); tree1.brag(); }
Thanks