help guys

Well we're not going to just write the code for you but I can give you a nudge in the right direction. The formula for converting centimeters to inches is

I = C * .39370078740157477

So, if you enter 47 centimeters then in inches that would be

I = 47 * .39370078740157477

Which would give you 18.50 inches. So we know that 1 foot = 12 inches so to convert 47 inches to feet would look like

(47 * .39370078740157477) / 12

Which would give us 1 foot 6.5 inches

commented: well constructed answer +3

I suspect that request may not be worded correctly.
1 foot = 12 inches. 1 inch = 2.54 cm 12 inches = 12 * 2.54 cm = 30.48 cm

Conversely, 30.48 cm = 1 foot.
Therefore 1 cm = 1 foot/30.48 which means 1 cm = .0328083 feet.

Well we're not going to just write the code for you but I can give you a nudge in the right direction. The formula for converting centimeters to inches is

So, if you enter 47 centimeters then in inches that would be

Which would give you 18.50 inches. So we know that 1 foot = 12 inches so to convert 47 inches to feet would look like

Which would give us 1 foot 6.5 inches

Thanks guys

but mathematically, (47 * .39370078740157477) / 12 doesn't equal = 1.65 or how do you come up with 1 foot 6.5 inches

another question how do I convert for example 7.6 to 7'6 (seven feet six inches)?

You're right, I meant to type it equals 1.54 feet not 1.65 so my bad for that. Here's how I came up with that:

(47 x .39370078740157477) = 18.50 (/ 12) = 1.54

ok my other question is how do I convert for example 1.54 to 1'54 (one foot fifty four inches)?

so that it how can create an output of 1'54 instead of 1.54?

I figured it out myself. I hope this helps someone else

double sizeX;
                double sizeY;
                double roundX;
                double roundY;
                double inchesX;
                double inchesY;

                sizeX = Math.Floor(Convert.ToDouble(ItemTitle.Size_CM_X) * 0.032808399);
                sizeY = Math.Floor(Convert.ToDouble(ItemTitle.Size_CM_Y) * 0.032808399);

                roundX =  (Convert.ToDouble(ItemTitle.Size_CM_X) * 0.032808399) - sizeX;
                roundY = (Convert.ToDouble(ItemTitle.Size_CM_Y) * 0.032808399) - sizeY;

                inchesX = Math.Floor(roundX * 12);
                inchesY = Math.Floor(roundY * 12);
                Title.Text = (sizeX + " ' " + inchesX) + " x " + (sizeY + " ' " + inchesY)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.