Thursday 22 March 2012

Print distance in feets and inches


#include<iostream>
using namespace std;
class dist
{
private:
 int feet;
 float inch;
public:
 void get()
 {
  cout<<"enter feets: "<<endl;
  cin>>feet;
  cout<<"enter inches: "<<endl;
  cin>>inch;
 }
 void print()
 {
cout<<"you entered: "<<endl;
cout<<"feets = "<<feet<<endl;
cout<<"and"<<endl;
cout<<"inches = "<<inch;
     cout<<endl;
 }
};


void main()
{
 dist d1;
 d1.get();
 d1.print();
}

No comments:

Post a Comment