-->

Facebook

Jasper Roberts - Blog

Wednesday, March 11, 2015

Write a C++ Program to demonstrate class.

#include<iostream.h>
//using namespace std;
class Abc
{
int a,b,c,x;
public:
void get_data(void);
void count(void);
void display(void);
};
void Abc::get_data(void)
{
cout<<"\nEnter the value of a = ";
cin>>a;
cout<<"\nEnter the value of b = ";
cin>>b;
cout<<"\nEnter the value of c = ";
cin>>c;
};
void Abc::count(void)
{
x=a/(b-c);
};
void Abc::display(void)
{
cout<<"\n x = "<<x;
};
void main()
{
Abc a;
a.get_data();
a.count();
a.display();
}

RELATED TOPICS
Write a C++ Program to convert temperature into Fahrenheit.
Write a C++ Program to demonstrate scope resolution operator.

No comments:

Post a Comment