实例 C 语言带有 default 关键字的 switch 语句

x
 
#include <stdio.h>
int main() {
  int day = 4;
  
  switch (day) {
  case 6:
    printf("Today is Saturday");
    break;
  case 7:
    printf("Today is Sunday");
    break;
  default:
    printf("Looking forward to the Weekend");
  }
  
  return 0;
}
                    

输出结果

Looking forward to the Weekend