I'm having trouble inputing a value into the switch control from scanf. I'm completely lost as to what the problem maybe.
Code:
#include <stdio.h>
int code = 0, hours = 0;
float salary = 0, wage = 0, base = 0;
int main()
{
while ( code != 6 )
{
printf("Enter number 1-6(6 to exit): ");
scanf("%d", &code);
/*---------Test code below------*/
printf("%d", code);
switch (code)
{
case '1':
printf("Enter weekly salary: ");
scanf("%lf", &salary);
printf("Well there you, you make %.2f a week\n", salary);
break;
/*
case '2':
printf("Enter hourly wage: ");
scanf("%lf", &wage);
printf("Enter hours worked in week: ");
scanf("%d", &hours);
if (hours > 40)
salary = ( (hours - 40) * 1.5 + 40 ) * wage;
else
salary = (float) hours * wage;
printf("You made %.2f this week\n", salary);
break;
default:
break;
*/
}
}
return 0;
}