I just started programming and this is one of my first tasks. I really don't understand why this code is not working. any help would be greatly appreciated
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
float temp;
int result1;
char scale;
char convert;
char ch1 = 'F';
char ch2 = 'f';
char ch3 = 'C';
char ch4 = 'c';
char ch5 = 'K';
char ch6 = 'k';
float result;
printf(" Please Enter Temperature: ");
scanf("%f", &temp);
printf("Scale is: ");
scanf("%s", &scale);
if(scale == 'F' || scale == 'f')
{
printf("convert to: ");
scanf("%s", &convert);
if(convert == 'c' || convert == 'C')
{
result = (temp-32)*(5/9);
printf("original temperature: %f\n", temp);
printf("scale conversion: %s to %s\n", scale, convert);
in here the error appears, it says "format specifies type 'char*' but the argument has type 'char'??
printf("result: %f\n", result);
}
else
if(scale == 'C' || scale == 'c')
{
printf("convert to:");
scanf("%s", &convert);
if(convert == 'f' || convert == 'F')
{
result= ((temp*1.8)+32);
printf("original temperature: %f\n", temp);
printf("scale conversion: %s to %s\n", scale, convert);
printf("result: %f\n", result);
}
else
if(scale == 'K' || scale == 'k')
{
printf("convert to:");
scanf("%s", &convert);
if(convert == 'C' || convert == 'c')
{
result=(temp+273);
printf("original temperature: %f\n", temp);
printf("scale conversion: %s to %s\n", scale, convert);
printf("result: %f\n", result);
}
else
if (scale == 'C' || scale == 'c')
{
printf("convert to:");
scanf("%s", &convert);
if(convert == 'K' || convert == 'k')
{
result=(temp-273);
printf("original temperature: %f\n", temp);
printf("scale conversion %s to %s\n", scale, convert);
printf("result: %f\n", result);
}
else
if (scale == 'F' || scale == 'f')
{
printf("convert to:");
scanf("%s", &convert);
if (convert == 'K' || convert == 'k')
{
result=((temp+459)*0.55);
printf("original temperature: %f\n", temp);
printf("scale conversion %s to %s\n", scale, convert);
printf("result: %f\n", result);
}
else
if (scale == 'K' || convert == 'k')
{
printf("convert to:");
scanf("%s", &convert);
if (convert == 'F' || convert == 'f')
{
result=(0.55*(temp-273)+32);
printf("original temperature: %f\n", temp);
printf("scale conversion %s to %s\n", scale, convert);
printf("result: %f\n", result);
}
}
}
}
}
}
}
printf("\nthank you so much for using this program...press any key to exit\n");
getchar();
return 0;
}