AcWing 661. 平均数3
原题链接
简单
if else
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
double a, b, c, d;
double y;
scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
double x = ( a * 2 + b * 3 + c * 4 + d ) / 10;
printf("Media: %.1lf\n", x);
if (x >= 7.0)
{
printf("Aluno aprovado.\n");
}
if (x < 5.0)
{
printf("Aluno reprovado.\n");
}
if(x>=5.0&&x<=7.0){
printf("Aluno em exame.\n");
scanf("%lf", &y);
printf("Nota do exame: %.1lf\n", y);
double z = (x + y) / 2;
if (z >= 5.0) printf("Aluno aprovado.\n");
else
{
printf("Aluno reprovado.\n");
}
printf("Media final: %.1lf\n", z);
}
return 0;
}