标签:输入 语言 info 函数 调用 输入日期 color turn code
1 //输入一个1-7的整数,输出对应的星期名,通过调用指针函数实现 2 #include<stdio.h> 3 char name[8][20]={"Illegal day","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}; 4 char *day_name(int n){ 5 if(n<1 || n>7){ 6 return name[0]; 7 }else{ 8 return name[n]; 9 } 10 } 11 12 int main(){ 13 int day; 14 char *str; 15 printf("请输入日期:\n"); 16 scanf("%d",&day); 17 str=day_name(day); 18 printf("%s\n",str); 19 return 0; 20 }
标签:输入 语言 info 函数 调用 输入日期 color turn code
原文地址:https://www.cnblogs.com/Tobi/p/9237850.html