2020-09-13 22:07:22
#include <stdio.h>int main(){ int month; printf("please enter a month:\n"); scanf("%d",&month); switch(month){ case 3: case 4: case 5: printf("%d is spring\n",month); break; case 6: case 7: case 8: pri
2020-09-13 18:47:57
#include <stdio.h>int main(){ char cGrade; printf("please enter your grade\n"); scanf("%c",&cGrade); printf("Grade is about:"); switch(cGrade){ case 'A': printf("90~100\n"); break; case '
2020-09-13 17:16:44
#include <stdio.h>int main(){ int jour,fee; printf("the milieage is taxi go:\n"); scanf("%d",&jour); fee=(jour<3)?6:6+(jour-3)*2; printf("the cost of get a taxi is %d\n",fee); return 0;}
2020-09-13 17:15:36
#include <stdio.h>int main(){ int iDay=0; int Monday=1,Tuesday=2,Wednesday=3,Thursday=4,Friday=5,Saturday=6,Sunday=7; printf("enter a day of week to get course:\n"); scanf("%d",&iDay); if(iDay>Friday){ if(iDay==Satur
2020-09-13 09:42:39
#include <stdio.h>int main(){ int num; printf("please enter a num:"); scanf("%d",&num); if(num==1){ printf("its main view is triangle\n"); }else if(num==2){ printf("the top view of the cone is circular\n
2020-09-13 08:32:07
比如设计一个过关的小游戏场景,根据提示输入一个数字,然后根据数字进入相应的关卡。 #include <stdio.h>int main(){ int num; printf("please enter cencorship:"); scanf("%d",&num); if(num==1){ printf("the current into first
2020-09-13 00:22:15
在C语言中,可以用if...else编写出一个选择游戏,选择竞猜商品价格。 如下:#include <stdio.h>int main(){ int price=97,gue; printf("please enter a number:\n"); scanf("%d",&gue); if(gue<price){ printf("you guess the numbe
2020-09-12 23:38:09
#include <stdio.h>int main(){ int year; printf("please enter a year\n"); scanf("%d",&year); if((year%4==0)&&(year%100!=0)||(year%400==0)){ printf("%d is a leap year\n",year); } else{ printf("%d i
2020-09-11 23:04:27
实例如下:比如客人到某地就餐,你可以根据人数选择就餐的安排餐位,及就餐环境。具体实例如下:#include <stdio.h>int main(){ int num; puts("the number of meals:"); scanf("%d",&num); if(num<=8) { printf("Arrange %d people dining table\n",num);
2020-09-08 22:44:14
本实例可以判断一个人成绩大于60通过考试,小于60分未通过考试。#include <stdio.h>int main(){ int score; puts("请输入你的考试成绩:"); scanf("%d",&score); if(score>60){ printf("your grade is %d\n",score); printf("pass the exam\n"); } if(