Example
#include<iostream.h>
#include<conio.h>
#include<math.h>
class stat
{
static int count;
int no;
public:
void getdata();
void display();
};
int stat::count;
void stat::getdata()
{
count++;
}
void stat::display()
{
cout<<"Total of given number is::"<<count<<endl;
}
int main()
{
stat s1,s2,s3,s4;
clrscr();
s1.getdata();
s1.display();
s2.getdata();
s2.display();
s3.getdata();
s3.display();
getch();
return 0;
}
/*==================================================================
OUTPUT
Total of given number is::1
Total of given number is::2
Total of given number is::3
*/
#include<iostream.h>
#include<conio.h>
#include<math.h>
class stat
{
static int count;
int no;
public:
void getdata();
void display();
};
int stat::count;
void stat::getdata()
{
count++;
}
void stat::display()
{
cout<<"Total of given number is::"<<count<<endl;
}
int main()
{
stat s1,s2,s3,s4;
clrscr();
s1.getdata();
s1.display();
s2.getdata();
s2.display();
s3.getdata();
s3.display();
getch();
return 0;
}
/*==================================================================
OUTPUT
Total of given number is::1
Total of given number is::2
Total of given number is::3
*/
No comments:
Post a Comment