English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

#include
int main()
{
double a;
char w;
scanf("%d",&w);

switch (w)
{
case 'f':
scanf("%lf", &a);
printf("F %lf",32.0+1.8*a);
break;
case 'k':
scanf("%lf", &a);
printf("K %lf",a+273);
break;
default:
printf("\n Enter f for foreignfeet, k for kelvin\n");
}
return 0;
}

2006-11-10 06:56:09 · 4 answers · asked by alp 1 in Computers & Internet Programming & Design

4 answers

use getchar() instead of scanf. if you want to use scanf replace the line scanf("%d",&w); with scanf("%c",&w); w = getchar(); is preferable to using scanf. scanf can suprise you reading newline characters from the character buffer.

2006-11-10 08:33:35 · answer #1 · answered by need_my_golden_retriever 1 · 0 0

scanf("%d",&w);

You said %d which means integer only. You probably meant to say %c which means single character.

2006-11-10 15:08:13 · answer #2 · answered by tkquestion 7 · 0 0

i&#
dun-
o
)
(6*9

2006-11-10 14:57:22 · answer #3 · answered by QueenKoopa 4 · 0 2

what the huh!?

2006-11-10 14:57:53 · answer #4 · answered by Me 6 · 1 0

fedest.com, questions and answers