AcWing 661. 平均数3
原题链接
中等
作者:
Stars
,
2021-02-17 19:54:29
,
所有人可见
,
阅读 368
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
double N1, N2, N3, N4, x, y, z;
cin >> N1 >> N2 >> N3 >> N4;
x = (N1 * 2.0 + N2 * 3.0 + N3 * 4.0 + N4 * 1.0) / (2.0 + 3.0 + 4.0 + 1.0);
cout.flags(ios::fixed);
cout.precision(1);
cout << "Media: " << x << endl;
if (x>=7.0)
{
cout<< "Aluno aprovado." <<endl;
return 0;
}
else
{
if (x<5.0)
{
cout<< "Aluno reprovado." <<endl;
return 0;
}
}
cout << "Aluno em exame." << endl;
cin >> y;
cout << "Nota do exame: " << y << endl;
z = (x + y) / 2.0;
if (z >= 5.0) {
cout << "Aluno aprovado." << endl;
} else {
cout << "Aluno reprovado." << endl;
}
cout << "Media final: " << z << endl;
return 0;
}