Sunday, February 27, 2011

convert millimeters into feet & inches

#include<iostream>
using namespace std;
int main()
{
        int mm,feet,inches;
        cout<<"Enter the length in millimeters\n" ;          //instructions
        cin>>mm;                                                         //input
        feet=(mm/25)/12;                                            //calculation
inches=(mm/25)%12;                                      //calculation
        cout<<"length = "<<feet<<" feet "<<inches<<" incheses"<<endl;
        return 0;
}





The compilation of the above program....

g++ -o<the name that you want compile> <file name> 

No comments:

Post a Comment