How to find this average for this programm read 3 grades for students

#include <iostream>
#include <string>

using namespace std;

const int arr_size = 30;
const int name_size = 20;

void f_name_s(char name[name_size][arr_size], int math[arr_size],int history[arr_size],int physics[arr_size],int& num_s);
void display_arr(char dstuds[name_size][arr_size], int math[arr_size],int history[arr_size] ,int physics[arr_size], int stud_num);

//*********************************************************
void f_name_s(char name[name_size][arr_size],int math[arr_size],int history[arr_size],int physics[arr_size], int& num_s)
{

int count;
       cout<<"Enter the number of students >> " ;
       cin>>num_s;
       for(count=0; count<num_s; count++)
       {
              cout<<"Enter the name of the student " << count+1<<": ";
              cin>>name[count];
     cout<<"Enter the grade for maths " << count+1<<": ";
              cin>>math[count];
     cout<<"Enter the grade for history " << count+1<<": ";
     cin>>history[count];
     cout<<"Enter the grade for physics " << count+1<<": ";
     cin>>physics[count];
       }
}
//*********************************************************
void display_arr(char dstuds[name_size][arr_size], int math[arr_size], int history[arr_size] , int physics[arr_size], int d_stud_num)
{

int d_count , count ;
       cout<< "Name"<< " "<<"Math Grade"<< "History Grade "<< " Physics Grade "<<  endl;


       for(d_count=0; d_count<d_stud_num; d_count++)
       {

              cout << dstuds[d_count]<< " " ;
     cout << math[d_count] << endl ;
     cout << history[d_count] << endl ;
     cout << physics[d_count] << endl ;
       }

}
//**********************************************************
int main () 

 int count;

for (count=0; count == 







//*********************************************************
int main(){
int stud_num;
char stud_arr[name_size][arr_size];
 int math[arr_size];
 int history[arr_size] ;
 int physics [arr_size] ;

       f_name_s(stud_arr, math, history, physics , stud_num);
       display_arr(stud_arr, math, history, physics ,stud_num);
       system("pause");
       return 0;
}

Could you be a little more specific please?

What is going wrong? Does your program not compile? Does it compile but not execute correctly? Are you asking about a logic error?

i have this program now
and erros else if

#include <iostream>
#include <string>
using namespace std;

const int arr_size = 30;
const int name_size = 20;

void f_name_s(char name[name_size][arr_size], int math[arr_size],int history[arr_size],int physics[arr_size],int average[arr_size],int& num_s);
void display_arr(char dstuds[name_size][arr_size], int math[arr_size],int history[arr_size] ,int physics[arr_size],int average[arr_size], int stud_num);

//*********************************************************
void f_name_s(char name[name_size][arr_size],int math[arr_size],int history[arr_size],int physics[arr_size], int average[arr_size] ,  int& num_s)
{

int count  ;

       cout<<"Enter the number of students >> " ;
       cin>>num_s;
       for(count=0; count<num_s; count++)
       {
              cout<<"Enter the name of the student " << count+1<<": ";
              cin>>name[count];
     cout<<"Enter the grade for maths " << count+1<<": ";
              cin>>math[count];
     cout<<"Enter the grade for history " << count+1<<": ";
     cin>>history[count];
     cout<<"Enter the grade for physics " << count+1<<": ";
     cin>>physics[count];
     average [count]  = (math[count] + history[count] + physics[count]) /3 ;




       }
}
//*********************************************************
void display_arr(char dstuds[name_size][arr_size], int math[arr_size], int history[arr_size] , int physics[arr_size],int average[arr_size],  int d_stud_num)
{

int d_count , count ;
       cout<< "Name"<< " "<<"Math Grade"<< "History Grade "<< " Physics Grade "<<  endl;


       for(d_count=0; d_count<d_stud_num; d_count++)
       {

              cout << dstuds[d_count]<< " " ;
     cout << math[d_count] << endl ;
     cout << history[d_count] << endl;
     cout << physics[d_count] << endl;
     cout << " the average is... : "<< average[d_count] << endl;
     if (average[d_count]<=20)&&(average[d_count]>=19);
     {
      cout<< "Total Grade:A:" <<endl;
     }
     else if(average[d_count]<=18.9)&&(average[d_count]>16);
     {
      cout << "Total Grade:B :" <<endl;
     }
     else if (average[d_count]<=15.9&&(average[d_count]>13);
     {
      cout << " Total Grade:C :" <<endl;
     }
     else if (average[d_count]<=12.9&&(average[d_count]>10);
     {
      cout << " Total Grade:D :" <<endl;
     }
     else (average[d_count]<10);
     {
      cout << " Total Grade:E :" <<endl;
     }



       }

}
//**********************************************************









//*********************************************************
int main(){
int stud_num;
char stud_arr[name_size][arr_size];
 int math[arr_size];
 int history[arr_size] ;
 int physics [arr_size] ;
 int average[arr_size];

       f_name_s(stud_arr, math, history, physics ,average, stud_num);
       display_arr(stud_arr, math, history, physics ,average, stud_num);
       system("pause");
       return 0;
}
This article has been dead for over six months. Start a new discussion instead.