26.8.15

Create a 'DISTANCE' class

Create a 'DISTANCE' class with :

-     feet and inches as data members

-     member function to input distance

-     member function to output distance

-     member function to add two distance objects

Write a main function to create objects of DISTANCE class. Input two distances and output the sum.

#include<iostream.h>

#include<conio.h>

class distance

{
int feet,inch;
public:
void getdistance(); void putdistance();

void adddistance(distance d1,distance d2);
};

void distance::getdistance()

{

cout<<"\nEnter the feet : "; cin>>feet;
cout<<"\nEnter the inches :"; cin>>inch;
}

void distance::putdistance()
{
cout<<"\n\nfeet = "<<feet; cout<<"\tinch = "<< inch;

}
void distance::adddistance(distance d1,distance d2)
{
inch=d1.inch+d2.inch;
feet=inch/12;
inch=inch%12;
feet=feet+d1.feet+d2.feet;
}

int main()

{

distance d1,d2,d3; clrscr();

cout<< "\nDistance 1 \n"; d1.getdistance();

cout<< "\nDistance 2 \n"; d2.getdistance(); d3.adddistance(d1,d2);
cout<<"\nThe Sum Of two distance is : "; d3.putdistance();
getch();

return(0);
}


*********************************OUTPUT****************************

Distance 1

Enter the feet : 13

Enter the inches :11

Distance 2

Enter the feet : 11

Enter the inches :11

The Sum Of two distance is :

feet = 25   inch = 10

65 comments:

  1. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Best Microsoft Azure Training Institute in Chennai | Best Microsoft Azure Training Institute in Velachery

    ReplyDelete
  2. Fast our site definitely will unquestionably turn out to be widely known with virtually all operating a blog families, because of its meticulous content pieces and / or review articles. UKdistance

    ReplyDelete
  3. This data can be mileage calculator effectively assembled just by getting to a calculator made for the reason.

    ReplyDelete
  4. This is really too useful and have more ideas from yours. keep sharing many things and thanks for sharing the information.

    Best python training institute in Kanchipuram

    ReplyDelete
  5. This is really too useful and have more ideas from yours. keep sharing many things and thanks for sharing the information.

    Best python training institute in Kanchipuram

    ReplyDelete
  6. Nice and informative article. Thanks for sharing such nice article, keep on updating.

    CandC++ programming training academy in Kanchipuram

    ReplyDelete
  7. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...

    Best Graphics Designing Training Academy in Kanchipuram

    ReplyDelete
  8. Thank you so much for sharing. Keep updating your blog. It will very useful to the many users.
    Best Web Designing Training Academy in Kanchipuram

    ReplyDelete
  9. Thank you so much for sharing. Keep updating your blog. It will very useful to the many users.
    Best Web Designing Training Academy in Kanchipuram

    ReplyDelete
  10. I have read your blog its very attractive and impressive. I like it your blog.
    Best Software Testing Training Academy in Kanchipuram

    ReplyDelete
  11. Your Blog is nice and informative..Thanks for sharing this valuable information with us..I am visiting this website regularly, this web site sharing nice thoughts

    Best MATLAB Training Academy in Kanchipuram

    ReplyDelete
  12. Thanks for this grateful information. all this information is very important to all the users and can be used good at all this process.


    Best Web Designing Training Academy in Kanchipuram

    ReplyDelete
  13. Great blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.
    Best Tally erp9 Course Training Institute in kanchipuram|

    ReplyDelete
  14. Nice..You have clearly explained about it ...Its very useful for me to know about new things..Keep on blogging..
    Best JAVA and J2EE Course Training Institute in kanchipuram|

    ReplyDelete
  15. Hi, am a big follower of your blog. I am really happy to found such a helpful and fascinating post that is written in well manner. Thanks for sharing such an informative post. keep update your blog.
    Best CCNA Course Training Institute in kanchipuram|

    ReplyDelete
  16. Great post.Thanks for one marvelous posting! I enjoyed reading it;The information was very useful.
    Best Best Web Designing and Development Course Training Institute in kanchipuram|

    ReplyDelete
  17. great doing. and i happy to visit your blog to know about this wonderful information. thanks for sharing. keep updating.
    Best Best Web Designing and Development Course Training Institute in kanchipuram|

    ReplyDelete
  18. Your info is really amazing with impressive content..Excellent blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog..
    Best Python Course Training Institute in kanchipuram|

    ReplyDelete
  19. Very impressive and informative blog.. thanks for sharing your valuable information.. it is very useful and easy to learn as well... keep rocking and updating... looking further..
    Best Tally Erp9.0 Course Training Institute in kanchipuram|

    ReplyDelete
  20. Quite Interesting post!!! Thanks for posting such a useful post. I wish to read your upcoming post to enhance my skill set, keep blogging.
    Best Web Technologies Course Training Institute in kanchipuram|

    ReplyDelete
  21. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…
    Best Linux Certification Course Training Institute in kanchipuram|

    ReplyDelete
  22. Quite Interesting post!!! Thanks for posting such a useful post. I wish to read your upcoming post to enhance my skill set, keep blogging.
    Best Web Technologies Course Training Institute in kanchipuram|

    ReplyDelete
  23. Nice Post! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep your blog as updated.
    Best Tally ERP 9 Course Training Institute in kanchipuram|

    ReplyDelete
  24. Interesting post! This is really helpful for me. I like it! Thanks for sharing!
    Best Graphic Designing Course Training Institute in kanchipuram|

    ReplyDelete
  25. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me
    Best PCB Training Course Training Institute in kanchipuram|

    ReplyDelete
  26. This is excellent information. It is amazing and wonderful to

    visit your site.Thanks for sharing this information, this is useful

    to me…no:1selenium automation training

    institute in kanchipuram.

    ReplyDelete
  27. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…no:1
    HP QTP / UFT Automation training institute in kanchipuram.

    ReplyDelete
  28. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    No:1 Tally Training Academy in kanchipuram

    ReplyDelete
  29. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    No:1 Tally Training Academy in kanchipuram

    ReplyDelete
  30. Really it was an awesome information...very interesting to read..You have provided an nice blog....Thanks for sharing..
    Best JAVA / J2EE / J2ME Course Training Institute in kanchipuram|

    ReplyDelete
  31. Excellent post. I have read your blog it's very interesting and informative. Keep sharing.
    Best JAVA / J2EE / J2ME Course Training Institute in kanchipuram|

    ReplyDelete
  32. Nice post.. Really you are done a wonderful job. Thanks for sharing such wonderful information with us. Please keep on updating...
    Best C & C++ Course Training Institute in kanchipuram|

    ReplyDelete
  33. Very nice post here and thanks for it .I always like and such a super blog of these post.Excellent and very cool idea and great blog of different kinds of the valuable information's.
    Best Tally Erp 9.0 Course Training Institute in kanchipuram|

    ReplyDelete
  34. This is really impressive post, I am inspired with your post, do post more blogs like this, I am waiting for your blogs.
    Best Tally Erp 9.0 Course Training Institute in kanchipuram|

    ReplyDelete
  35. Interesting post!!! Thanks for posting such a useful information. I wish to read your upcoming post to enhance my skill set and keep blogging.
    Best Tally Erp 9.0 Course Training Institute in kanchipuram|

    ReplyDelete
  36. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing..
    No:1 Tally Training Academy in kanchipuram

    ReplyDelete
  37. This is excellent information. It is amazing and wonderful to visit your

    site.Thanks for sharing this information, this is useful to me.
    Best Selenium

    Automation Course Training Institute in kanchipuram
    |

    ReplyDelete
  38. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing..
    No:1 Tally Training Academy in kanchipuram

    ReplyDelete
  39. Very good and informative information. Thanks for sharing such nice blog, keep on updating such good post.
    Best Software Testing Course Training Institute in kanchipuram|

    ReplyDelete
  40. I have read your blog. Good and more information useful for me, Thanks for sharing this information keep it up....
    Best Dot Net Course Training Institute in kanchipuram|

    ReplyDelete
  41. Really it was an awesome blog...very interesting to read..You have provided an nice information....Thanks for sharing..
    Best Hardware & Networking Course Training Institute in kanchipuram|

    ReplyDelete
  42. Thanks for sharing in this blog...its very useful for us...keep on going...
    Best MS Office Course Training Institute in kanchipuram|

    ReplyDelete
  43. Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it.
    Best PCB (Printed Circuit Board) Course Training Institute in kanchipuram|

    ReplyDelete
  44. Thanks for making me this Blog. You have done a great job by sharing this content here. Keep writing blog like this
    No:1
    Graphic Design Training Academy in kanchipuram

    ReplyDelete
  45. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
    Best PCB (Printed Circuit Board) Course Training Institute in kanchipuram|

    ReplyDelete
  46. Nice blog. Thank you for sharing. The information you shared is very effective for

    learners I have got some important suggestions from it.
    No:1 Hardware and Networking

    Training Academy in Kanchipuram


    ReplyDelete
  47. I love reading and following your post as I find them extremely informative and interesting.
    Best AWS (Advanced Amazon Web Services) Course Training Institute in kanchipuram|

    ReplyDelete
  48. Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it…
    No:1
    Embedded Systems Training Academy in kanchipuram

    ReplyDelete
  49. Awesome post. Really you are shared very informative information... Thank you for sharing. Keep on updating...
    Best AWS (Advanced Amazon Web Services) Course Training Institute in kanchipuram|

    ReplyDelete
  50. Great post..Its very useful for me to understand the information..Keep on blogging..
    Best Software Testing Course Training Institute in kanchipuram|

    ReplyDelete
  51. Nice..You have clearly explained about the conept..Its very useful for me to undertand..Keep on sharing..

    No:1 Azure Training Academy in Kanchipuram



    ReplyDelete
  52. I found some useful information in your blog, it was awesome to read, thanks for sharing this great information to my vision, keep sharing.
    Best Graphic Designing Course Training Institute in kanchipuram|

    ReplyDelete
  53. Marvelous and fascinating information.Thanks for this greatful blog. keep your blog updated.
    Best Hardware & Networking Course Training Institute in kanchipuram|

    ReplyDelete
  54. Thanks a lot for offering this unique post with us. I really enjoyed by reading your blog post.keep sharing.
    Best Python Course Training Institute in kanchipuram|

    ReplyDelete
  55. This is really awesome. Full of knowledge and latest information.Thanks for sharing.
    Best JAVA / J2EE / J2ME Course Training Institute in kanchipuram|

    ReplyDelete
  56. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…
    No:1 python Training Center in Kanchipuram







    ReplyDelete
  57. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    No:1 Best EEE Project Center in kanchipuram|

    ReplyDelete
  58. The provided information’s are very useful to me.Thanks for sharing.Keep updating your blog.No:1 ECE project Centre in kanchipuram

    ReplyDelete
  59. really you have posted an informative blog. it will be really helpful to many peoples. thank you for sharing this blog. so keep on sharing such kind of useful blogs.
    No:1 Best NS2 (Network Simulator) Project Center in kanchipuram|

    ReplyDelete
  60. The provided information’s are very useful to me.Thanks for sharing.Keep updating your blog.No:1 Bit data project Centre in kanchipuram

    ReplyDelete

Comment Here