Search This Blog

Friday, December 10, 2010

A very first program in c++ with the concept of class

include
using namespace std;

class person
{
private:
   char name[20];
   int age;

public:
    void getdata(void);
    void dislpay(void);
};
void person :: getdata(void)
{
cout<<"Enter name:";
cin>>name;
cout<<"Enter age:";
cin>>age;
}
void person :: display(void)
{
cout<<"\nName: "<
cout<<"\nAge: "<
}
int main()
{
  person p;

  p.getdata();
  p.display();

  return 0;
}

No comments:

Post a Comment