Ok, here's a quick lesson on classes. This is a class.
Code:
#include <iostream.h>
class iwork //start out defining a class like this iwork can be substuted with any other name
{
public: //basically...for now...just put your functions in public, it's good practice
//constructor
iwork(); //don't really worry about this, just do it
//functions going to be used in the class
void test1(); //gathers the number
void test2(); //outputs the contents of number gathered in test1();
private:
//variables going to be used ONLY in this class...this is important when you get into inheritance.
int number;
};//<-------note the semicolon
iwork::iwork()
{
//just makes the constructor happy
}
void iwork::test1()
{
cout<<"Enter a number." <<endl;
cin>>number;
test2();
}
void iwork::test2()
{
cout<<"The number entered is: " <<number <<endl;
}
main()
{
iwork inst; //creates an instance of the class so you can use it.
inst.test1();
return 0;
}
Please ask me any questions you may have...I'm still a newbie myself, but yea...I wanna help =) My AIM name is RevolutionST.
Edit1: ......I'm on my way home from work, I'll elaborate when I get home.
Edit2: I'm home now.