14 November 2011

A simple class program in C++

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class student
{
private:
int age;
char name[10];
public:
void getdata()
{
cin>>name;
cin>>age;
}
void putdata()
{
cout<<"Your name is "<<name;
cout<<"Your age is "<<age;
}
};
void main()
{
student st;
st.getdata();
st.putdata();
clrscr();



getch();
}

0 comments:

Post a Comment