Good evening, I have to make a program that reads two student grades, the average of the two has to be 6, if you can not take an average of 6, will make a third test and calculate a new average.
I'm not getting the new display medium, without repeating the approved and disapproved, can someone take a look and help me?
// TRABAV2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
float av1[30], av2[30], av3[30], media[30], media2[30];
int i, qtd, matri[30];
cout<<"Digite o numero de alunos: ";
cin>>qtd;
for (i=1;i<=qtd;i++)
{
cout<<"Matricula ";
cin>>matri[i];
cout<<"AV1: ";
cin>>av1[i];
while (av1[i]>10)
{
cout<<"0 a 10. AV1: ";
cin>>av1[i];
}
cout<<"AV2: ";
cin>>av2[i];
while (av2[i]>10)
{
cout<<"0 a 10. AV2: ";
cin>>av2[i];
}
media[i]=(av1[i]+av2[i])/2;
while (media[i]>=6)
{
cout<<"Aprovado!"<<endl;
break;
}
if (media[i]<6)
{
cout<<"AV3: ";
cin>>av3[i];
}
}
system ("pause");
return 0;
}
Maybe giving a little more explanation of the requirements of the program would allow people to help you more effectively.
Your first line is helpful in explaining the program's purpose:
I have to make a program that reads two student grades, the average of the two has to be 6, if you can not take an average of 6, will make a third test and calculate a new average.
But could you clarify and possibly add to this comment:
I'm not getting the new display medium, without repeating the approved and disapproved...
As a clarifying question, do you mean how come your new median or average result calculated in av3 isn't being displayed by itself (i.e. without "Aprovado!")?