centimeters to feet and inch conversion

#include <cstdio>
#include <iostream>
#include <iomanip>
using namespace std;
int main ()

{
double cen, inch, feet;
float cen1, feet1;
feet1=cen1/2.54/12;
cin >> cen1;
printf("%.1f",cen1," centimeters is ",double(feet1)," feet ",(float(feet1)-int(feet1)))*12," inches.";
}
So far I have gotten this code to convert centimeters to feet and inches. For some reason, when I input any number it just prints it back out again. Also, I have this error:Multiple markers at this line
- too many arguments for format
- right-hand operand of comma has
no effect
Just use std::cout.

This:
 
feet1=cen1/2.54/12;
only makes sense in a declarative language, like Haskell. C++ doesn't work like this.
Last edited on
Topic archived. No new replies allowed.