Guest User

Untitled

a guest
Nov 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. //Enrique Castelan
  2. //September 13, 2011
  3. //Recieves a distance from the user in centimeters and converts it and displays it in inches
  4.  
  5. #include <iostream>
  6. #include <conio>
  7.  
  8. int main()
  9. {
  10.  
  11. int cm, feet, yd;
  12. double inch;
  13.  
  14. //Asks user for distance and stores it to cm
  15. cout<<"Enter distance in centimeters: ";
  16. cin>>cm;
  17.  
  18. //Converts centimeters to inches
  19. inch = cm/2.54;
  20.  
  21. if ((inch-int(inch))>.5)
  22. inch = int(inch) + 1;
  23.  
  24. feet = inch/12;
  25. yd = feet/3;
  26.  
  27. cout<<inch;
  28. getch();
  29.  
  30. }
Add Comment
Please, Sign In to add comment