A. 
#include<iostream.h>
#include<conio.h>
class demo
{
public:
                int x;
                float y;
};
void main()
{
                clrscr();
                demo d;
                d.x=10;
                d.y=20.5;
                cout<<"The Value of X = "<<d.x<<endl;
                cout<<"The Value of Y = "<<d.y<<endl;
                getch();
}
139 A.PNG
B.
#include<iostream.h>
#include<conio.h>
class demo
{
public:
                int x;
                float y;
};
void main()
{
                clrscr();
                demo d;
                cout<<"Enter The Value of X : ";
                cin>>d.x;
                cout<<"Enter The Value of Y : ";
                cin>>d.y;
                cout<<"\nThe Value of X = "<<d.x<<endl;
                cout<<"The Value of Y = "<<d.y<<endl;
                getch();
}
139-b
C. 
#include<iostream.h>
#include<conio.h>
class demo
{
public:
                int x;
                float y;
                void input()
                                {
                                cout<<"Enter The Value of X : ";
                                cin>>x;
                                cout<<"Enter The Value of Y : ";
                                cin>>y;
                                }
                void display()
                                {
                                cout<<"\nThe Value of X = "<<x<<endl;
                                cout<<"The Value of Y = "<<y<<endl;
                                }
};
void main()
{
                clrscr();
                demo d;
                d.input();
                d.display();
                getch();
}
139 C.PNG
Advertisements