#include <iostream>
#include <conio.h>
usingnamespace std;
void main()
{
int i, t1, t2, ava;
for (i =1 ; i < 5 ; i++)
{
cout <<"Please enter your Test1:\n\n";
cin >> t1;
cout <<"\n\nPlease enter your Test2:";
cin >> t2;
}
getch();
}
but the Problem is i need to show the avarage after each calculation.
void main()
{
int i, t1, t2, ava;
for (i =1 ; i < 5 ; i++)
{
cout <<"\nPlease enter your Test1:\n\n";
cin >> t1;
cout <<"\n\nPlease enter your Test2:\n\n";
cin >> t2;
ava = (t1+t2)/2;
}cout <<"Your Grade is : " << ava;
getch();
}
How can i get the ava after each calculation ? because it's not showing 1 time only
#include <iostream>
#include <conio.h>
usingnamespace std;
void main()
{
int i, t1, t2, ava;
for (i =1 ; i < 42 ; i++)
{
cout << "Student " << i << " out of 42, Please enter your Test1: ";
cin >> t1;
cout << "\n\nPlease enter your test2 :";
cin >> t2;
cout << "\n\n";
ava = (t1+t2)/2;
}cout <<"the Grade of the Class is : " << ava;
getch();
}