farah.fahhoum's blog

By farah.fahhoum, history, 9 years ago, In English

this code always has wrong when i run it on uri online judge please find me the bug this is the problem https://www.urionlinejudge.com.br/judge/en/problems/view/1040 and this is my c++ code

` #include using namespace std; double N1,N2,N3,N4; double Average1,Average2; double Score;

int main()
{
cin >> N1 >> N2 >> N3 >> N4;
cin >> Score;
Average1 = ((2*N1)+(3*N2)+(4*N3)+(1*N4))/10.0;
cout <<"Media: ";
printf ("%.1lf\n",Average1);

if (Average1 >= 7.0)
cout <<"Aluno aprovado.\n";
else if (Average1 < 5.0)
cout <<"Aluno reprovado.\n";
else if (5.0 < Average1 && Average1 < 6.9)
cout <<"Aluno em exame.\n";
printf ("Nota do exame: %.1lf",Score);
cin >> Score;
Average2 = (Score+Average1)/2.0;
if (Average2 >= 5.0)
{
cout <<"\nAluno aprovado.\n";
 }
else if 
(Average2 <= 4.9)
cout <<"Aluno reprovado.";

cout <<"\nMedia final: "; printf ("%.1lf",Average2); cout <<endl; return 0;
}`

Tags c++
  • Vote: I like it
  • -11
  • Vote: I do not like it