項目一:三級成績流程圖
對應的程序:
//三級成績
#include <stdio.h>
int main()
{
int result;
printf("請輸入一個百分制成績:");
scanf("%d",&result);
if(result>100)
{
printf("請重新輸入");
}
else
{
if(result>=90)
{
printf("該成績優秀:%d\n",result);
}
else
{
if(result>=60)
{
printf("該成績合格:%d\n",result);
}
else
{
printf("該成績不合格:%d\n",result);
}
}
}
return 0;
}
項目二:五級成績流程圖
對應的程序:
//五級成績
#include <stdio.h>
int main()
{
int result;
printf("請輸入百分制成績:");
scanf("%d",&result);
if(result>100)
{
printf("請重新輸入");
}
else
{
if(result>=90)
{
printf("該成績優秀:%d\n",result);
}
else
{
if(result>=80)
{
printf("該成績良好:%d\n",result);
}
else
{
if(result>=70)
{
printf("該成績中等:%d\n",result);
}
else
{
if(result>=60)
{
printf("該成績及格:%d\n",result);
}
else
{
printf("不及格:%d\n",result);
}
}
}
}
}
return 0;
}
項目三:體重監測器流程圖
對應的程序:
//男生體重監測器
#include <stdio.h>
int main()
{
int standard_weight,height;
printf("請輸入你的身高:");
scanf("%d",&height);
standard_weight = height-100;
printf("標準體重是:%d\n",standard_weight);
int weight;
printf("請輸入你現在的體重:");
scanf("%d",&weight);
if(weight<=0)
{
printf("不符合要求,請重新輸入!\n");
}
else
{
if(weight >= standard_weight*1.2)
{
printf("已經超重:要注意了!\n");
}
else
{
if(weight <= standard_weight*0.8)
{
printf("低於標準體重,要加油!\n");
}
else
{
printf("安啦!\n");
}
}
}
return 0;
}