switch Statements | C Programming Tutorial

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Video about switch statement, but I learned a lot of cool things. Thank you, Sir!

saidrafili
Автор

Kevin thanks for great video; I think a lot of people might skip over covering switch statements but as shown; by using fall through logic they can be very useful. I wrote the code out and included a default: section to keep track of consonants ie. ++consonants; that is presuming the random string only contains letters.

towtruckn
Автор

STEP BY STEP TUTORIAL FOR LEARNERS.I appreciate your contribution.

treklin
Автор

here is an easier example
#include <stdio.h>

int main() {
int day;

printf("Enter a day of the week (1-7): ");
scanf("%d", &day);

switch(day) {
case 1:
printf("Sunday\n");
break;
case 2:
printf("Monday\n");
break;
case 3:
printf("Tuesday\n");
break;
case 4:
printf("Wednesday\n");
break;
case 5:
printf("Thursday\n");
break;
case 6:
printf("Friday\n");
break;
case 7:
printf("Saturday\n");
break;
default:
printf("Invalid input\n");
break;
}

return 0;
}

idhemhyouka
join shbcf.ru