You are on page 1of 1

EXP5_3 #include<iostream.h> #include<conio.

h> class weight { public: static float g; float m,w; void accept() { cout<<"Enter the mass of an object on earth"; cin>>m; } static void mass() { m= 9.81; cout<<"Mass by default is:\t"<<m; } void display() { w=m*g; cout<<"\nWeight of the object:"<<w; } }; float weight::g; void main() { clrscr(); weight s; weight::mass(); s.accept(); s.display(); getch(); }

Page 1

Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

You might also like