tansfering scan,print to cin,cout

how can I transfer this 2 codes into cin,cout instead of scan,print
I need your help please

Char X;
float w ,l ,b , h , r ;
const float pi = 3.14;
Scanf("%c",X)
if (X==R) {scanf("%f,%f" w,l)
printf("%f" (w*l)
}
if (X==T){scanf("%f,%f" b,h)
printf("%f" (0.5*b*h)
}
if (X==C) {scanf("%f" r)
printf("%f" pow(r,2)*pi)
}
else printf("please enter R || T || C")


///////////////////////////////////////////

Char X;
float w ,l ,b , h , r ;
const float pi = 3.14;
Scanf("%c",X)
Switch(X)
Case R: {scanf("%d,%d" w,l)
printf("%f" (w*l)
}
Case T: {scanf("%f,%f" b,h)
printf("%f" (0.5*b*h)
}
Case C: {scanf("%f" r)
printf("%f" pow(r,2)*pi)
}
else printf("please enter R || T || C")

You've been lazy. You could have posted code that would have compiled, but you haven't.

Why don't you post valid C or C++ code then someone can help with the translation.
Topic archived. No new replies allowed.