grade1+grade2+grade3/3
is wrong. Division is calculated before addition in C++, so only grade3
is divided by 3 while grade1
and grade2
are not divided.
You have already calculated average
, so you should use that instead of the wrong formulas.
Also the condition looks wrong. It seems you should use >=
or >
(according to the specification) instead of <=
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…