How to make an algorithm that receives the name of a day of the week and shows the subject that the student has on the day

Asked

Viewed 92 times

-4

the part of logic I know is simple but I believe I’m wrong in the syntax, in my view it would be if day == second printf("second class") but so not sure, someone could help me, I’m trying to do in C.

"Develop a C program that receives a day of the week and shows what(s) discipline(s) you have that day of the week"

  • 1

    https://answall.com/tour

  • Lucas, edit your question and include the code with what you already tried so we can help you.

1 answer

1

Try to do it this way:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){ 
    char dia[50];
    printf("Digite o dia da semana: \n");
    scanf("%s",dia);

    if(strcmp(dia,"segunda") == 0){
        printf("\nEh segunda!");
    }else{
        printf("\nNao eh segunda!");
    }

    return 0;
}
  • my difficulty is to repeat the action understand, because the user is free to type other days of the week also as Wednesday, Thursday.. and for every day shows a different phrase that I’m not able to do

Browser other questions tagged

You are not signed in. Login or sign up in order to post.