#Compare strings

4 messages · Page 1 of 1 (latest)

lone gyro
#
#include <stdio.h>

int main() {
    printf("Temperature converter\nType \"Celsius\" to convert from farenheit to celsius or \"farenheit\" to convert from celsius fo farenheit\n");
    char type[25];
    scanf("%s", &type);

    if (type == 'Celsius') {
        printf("Type how many degrees to convert to farenheit");
        
        int degrees;
        scanf("%d", &degrees);
        printf("%dF", (degrees * 9 / 5)+32);
    }
}```
How can I compare if type is "Celsius"
regal leafBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

lone gyro
#

!solced

#

!solved