我一开始不知道权重是什么,后来弄明白了,但提交不对。后来我找到两处错误:第1我输出的时候没加点,第2输出的时候冒号没加空格。
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
//freopen("xxx.in","r",stdin);
//freopen("yyy.out","w",stdout);
double N1,N2,N3,N4,Y;
cin >> N1 >> N2 >> N3 >> N4;
double X;
X=N1*2/10+N2*3/10+N3*4/10+N4*1/10;
cout << "Media: " << fixed << setprecision(1) << X << endl;
if(X>=7.0)
cout << "Aluno aprovado." << endl;
else if(X<5.0)
cout << "Aluno reprovado." << endl;
else if(X>=5.0 && X<7.0)
{
cout << "Aluno em exame." << endl;
cin >> Y;
cout << "Nota do exame: " << Y << endl;
double Z;
Z=(X+Y)/2;
if(Z>=5.0)
cout << "Aluno aprovado." << endl;
else
cout << "Aluno reprovado." << endl;
cout << "Media final: " << fixed << setprecision(1) << Z << endl;
}
//fclose(stdin);
//fclose(stdout);
return 0;
}