Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Enrique Castelan
- //September 13, 2011
- //Recieves a distance from the user in centimeters and converts it and displays it in inches
- #include <iostream>
- #include <conio>
- int main()
- {
- int cm, feet, yd;
- double inch;
- //Asks user for distance and stores it to cm
- cout<<"Enter distance in centimeters: ";
- cin>>cm;
- //Converts centimeters to inches
- inch = cm/2.54;
- if ((inch-int(inch))>.5)
- inch = int(inch) + 1;
- feet = inch/12;
- yd = feet/3;
- cout<<inch;
- getch();
- }
Add Comment
Please, Sign In to add comment