这是我的代码:
#include <stdio.h>#define LENGH_OF_WEEK 7int main(){ int daysOfWeek[LENGH_OF_WEEK] = {0,1,2,3,4,5,6}; char* dayname = NulL;int i;for (i = 0; i < LENGH_OF_WEEK; i++){ switch (daysOfWeek[i]) { case 0: dayname = "Sunday"; break; case 1: dayname = "Monday"; break; case 2: dayname = "Tuesday"; break; case 3: dayname = "Wednesday"; break; case 4: dayname = "Thursday"; break; case 5: dayname = "FrIDay"; break; case 6: dayname = "Saturday"; break; } printf("%s,%s Happy Days\n",dayname,dayname);}return 0;}
正如你所看到的,我正试图让我的控制台唱出Happy Days,但它只是说dayname两次,我想弄清楚如何让它说“星期六,一整天!Groovin”整周与你同在!”案例6.
解决方法 这是我的经典主题曲的版本.抱歉,没有使用switch语句#include <stdio.h>char *day[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","FrIDay","Saturday"};int main(){int i;for (i = 0; i < 5; i+=2){ printf("%s,day[i],day[i+1]);}printf("Saturday,what a day\n Groovin' all week with you!\n");return 0;}总结
以上是内存溢出为你收集整理的增加函数中的案例编号?全部内容,希望文章能够帮你解决增加函数中的案例编号?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)