#include<iostream>
using namespace std;
class simple1
{
private:
int a;
int b;
public:
void getdata()
{
cout<<"please enter the value of a:";
cin>>a;
cout<<"please enter the value of b:";
cin>>b;
}
void display()
{
cout<<"value of a is:"<<a<<endl;
cout<<"value of b is:"<<b<<endl;
}
};
class simple2
{
private:
float a;
float b;
public:
void getdata()
{
cout<<"please enter the value of a:";
cin>>a;
cout<<"please enter the value of b:";
cin>>b;
}
void display()
{
cout<<"value of a is:"<<a<<endl;
cout<<"value of b is:"<<b<<endl;
}
};
class simple3
{
private:
int a;
float b;
public:
void getdata()
{
cout<<"please enter the value of a:";
cin>>a;
cout<<"please enter the value of b:";
cin>>b;
}
void display()
{
cout<<"value of a is:"<<a<<endl;
cout<<"value of b is:"<<b<<endl;
}
};
class simple4
{
private:
float a;
int b;
public:
void getdata()
{
cout<<"please enter the value of a:";
cin>>a;
cout<<"please enter the value of b:";
cin>>b;
}
void display()
{
cout<<"value of a is:"<<a<<endl;
cout<<"value of b is:"<<b<<endl;
}
};
int main()
{
simple1 s1;
simple2 s2;
simple3 s3;
simple4 s4;
cout<<"two integer data type:"<<endl;
s1.getdata();
s1.display();
cout<<"two float data type:"<<endl;
s2.getdata();
s2.display();
cout<<"one integer and one float data type:"<<endl;
s3.getdata();
s3.display();
cout<<"one float and one integer data type:"<<endl;
s4.getdata();
s4.display();
}
No comments:
Post a Comment