0
#include<stdio.h>
#include<conio.h>
#include<string.h>
#define max  30

void Cal_semester_Grade(char studname[][25],int gradeavg[max],int examavg[max]);
void Class_Grade(char studname[][25],char classname[5],int classgrd[max][3],int gradeavg[max], int Maxtestscr[][3],char subject[15]);
void Exam_Grade(char studname[][25],char classname[5],char subjectname[15],int examavg[max],int Maxtestscr[max][3],int examgrd[max][3]);
void Search_name(char);
void Menu();
char studname[max][25];
int gradeavg[max];
int classgrd[max][3];
int examgrd[max][3]
int semesteravg[max];
char classname[5];
char subjectname[15];
int examavg[max];
int Maxtestscr[max][3];





int main(void)
{

int choice,i,y,d;


{

Menu();
printf("Please enter choice");
scanf("%d",&choice);
switch (choice)
{
case 1:

   for(i=0;i<max;i++)
    {
      printf("\n Please enter students name:");
      scanf("%s",&studname[i]);
      printf("\n Please enter students class name:");
      scanf("%s",&classname[i]);
      printf("\n Please enter subject name:");
      scanf("%s",&subjectname[i]);
      printf("\n Please enter Class grade:");
      scanf("%s",&classgrd[i]);
      Class_Grade( studname,classname,classgrd,gradeavg,Maxtestscr,subjectname);
}

break;

case 2:
	for(y=0;y<max;y++)
    {
      printf("\n Please enter students name:");
      scanf("%s",&studname[y]);
      printf("\n Please enter students class name:");
      scanf("%s",&classname[y]);
      printf("\n Please enter subject name:");
      scanf("%s",&subjectname[y]);
      printf("\n Please enter exam grade:");
      scanf("%s",&examgrd[y]);
		Exam_Grade(studname,classname,subjectname,examavg,Maxtestscr,examgrd);

break;

case 3:
	for(d=0;d<max;d++)
   {
   	printf("\n Please enter students name:");
      scanf("%s",&studname[d]);
      printf("\n Please Exam Average:");
      scanf("%s",&examavg[d]);
      printf("\n Please enter Grade Average:");
      scanf("%s",&gradeavg[i]);
		Cal_semester_Grade(studname,gradeavg,examavg);

break;

case 4:Menu();
default:
printf("You have entered an ivalid choice");
}
getch();
return 0;
}


void Menu()
{
printf("**************WELCOME TO MAIN MENU*************");

printf("\n1.Calculate class grade");
printf("\n2.Calculate Exam grade");
printf("\n3.Calculate semester grade");
printf("\n4.Enter Student's Name to Search");
printf("\n5.5Return to Main Menu");
getch();
}


void  Class_Grade(char studname[][25],char classname[5], int classgrd[max][3],int gradeavg[max], int Maxtestscr[][3],char subject [15])
{
     for(int a=0;a<max;a++)
     {
         for(int z=0; z<3;z++)
         {
            gradeavg[z]=classgrd[a][z]/Maxtestscr[a][z];
         }
     }

 }



void Exam_Grade(char studname[][25],char classname[5],char subject [15],char examavg[max],int Maxtestscr[max][3],int examgrd[max][3];
{
	 for(int b=0;b<max;b++)
     {
         for(int c=0; c<3;c++)
         {
            examavg[c]=examgrd[b][c]/Maxtestscr[b][c];
         }
     }



}

void Cal_semester_Grade(char studname[][25],int gradeavg[max],int examavg[max]);
{
	for(int e=0;e<max;e++)

    {
         for(int f=0; f<1;f++)
         {
            semesteravg[f]=(examavg[e][f]+gradeavg[e][f])/2;
         }
     }

void Search_name(char);

getch ();
}}



}}
0

Is this program compiling/working ? or are there still compile errors/bugs in it ?

there are 4 errors so i cant get it to run.

0

> int examgrd[MAX][3] you forgot to put a semicolon ';' at the end, change it to int examgrd[MAX][3]; > I get 9 other errors also :), what compiler are you using and under which filename did you save this stuff ? (As it's a C program it has to have the '.c' file-extension ...

> Why are you declaring all your variables global ? This isn't a good practice, it's really bad when it's actually not needed :) ...

0

> int examgrd[MAX][3] you forgot to put a semicolon ';' at the end, change it to int examgrd[MAX][3]; > I get 9 other errors also :), what compiler are you using and under which filename did you save this stuff ? (As it's a C program it has to have the '.c' file-extension ...

> Why are you declaring all your variables global ? This isn't a good practice, it's really bad when it's actually not needed :) ...

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define max 30

void Cal_semester_Grade(char studname[][25],float gradeavg[max],float examavg[max]);
void Class_Grade(char studname[][25],char classname[5],int classgrd[max][3],float gradeavg[max], int Maxtestscr[][3],char subject[15]);
void Exam_Grade(char studname[][25],char classname[5],char subjectname[15],float examavg[max],int Maxtestscr[max][3],int examgrd[max][3]);
void Search_name(char);
void Menu();
char studname[max][25];
float gradeavg[max];
int classgrd[max][3];
int examgrd[max][3];
float semesteravg[max];
char classname[5];
char subjectname[15];
float examavg[max];
int Maxtestscr[max][3];






int main(void)
{

int choice,i,y,d;



{

Menu();
printf("Please enter choice");
scanf("%d",&choice);
switch (choice)
{
case 1:

   for(i=0;i<max;i++)
    {
      printf("\n Please enter students name:");
      scanf("%s",&studname[i]);
      printf("\n Please enter students class name:");
      scanf("%s",&classname[i]);
      printf("\n Please enter subject name:");
      scanf("%s",&subjectname[i]);
      printf("\n Please enter Class grade:");
      scanf("%s",&classgrd[i]);
      Class_Grade( studname,classname,classgrd,gradeavg,Maxtestscr,subjectname);
}

break;

case 2:
	for(y=0;y<max;y++)
    {
      printf("\n Please enter students name:");
      scanf("%s",&studname[y]);
      printf("\n Please enter students class name:");
      scanf("%s",&classname[y]);
      printf("\n Please enter subject name:");
      scanf("%s",&subjectname[y]);
      printf("\n Please enter exam grade:");
      scanf("%s",&examgrd[y]);
		Exam_Grade(studname,classname,subjectname,examavg,Maxtestscr,examgrd);

break;

case 3:
	for(d=0;d<max;d++)
   {
   	printf("\n Please enter students name:");
      scanf("%s",&studname[d]);
      printf("\n Please Exam Average:");
      scanf("%s",&examavg[d]);
      printf("\n Please enter Grade Average:");
      scanf("%s",&gradeavg[i]);
		Cal_semester_Grade(studname,gradeavg,examavg);

break;

case 4:Menu();
default:
printf("You have entered an ivalid choice");
}
getch();
return 0;
}


void Menu()
{

printf("**************WELCOME TO MAIN MENU*************");

printf("\n1.Calculate class grade");
printf("\n2.Calculate Exam grade");
printf("\n3.Calculate semester grade");
printf("\n4.Enter Student's Name to Search");
printf("\n5.5Return to Main Menu");
getch();
}


void  Class_Grade(char studname[][25],char classname[5], int classgrd[max][3],float gradeavg[max], int Maxtestscr[][3],char subject [15])
{
     for(int a=0;a<max;a++)
     {
         for(int z=0; z<3;z++)
         {
            gradeavg[z]=classgrd[a][z]/Maxtestscr[a][z];
         }
     }

 }



void Exam_Grade(char studname[][25],char classname[5],char subject [15],float examavg[max],int Maxtestscr[max][3],int examgrd[max][3];
{
	 for(int b=0;b<max;b++)
     {
         for(int c=0; c<3;c++)
         {
            examavg[c]=examgrd[b][c]/Maxtestscr[b][c];
         }
     }



}

void Cal_semester_Grade(char studname[][25],float gradeavg[max],float examavg[max]);
{
	for(int e=0;e<max;e++)

    {
         for(int f=0; f<1;f++)
         {
            semesteravg[f]=(gradeavg[e][f]+examavg[e][f])/2;
         }
     }

void Search_name(char);

getch ();
}}



}}

Ok i got 3 errors now, and im using Boreland C++. Teacher made me declare the variables globally, as im going to be using it throughout the functions.

0

Ok i got 3 errors now, and im using Boreland C++. Teacher made me declare the variables globally, as im going to be using it throughout the functions.

First of all: It's Borland and not Boreland :P, secondly: "as im going to be using it throughout the functions", that's not a real reason to declare your variables globally as you can still pass it to the function as an argument (or pass a pointer to it to a function) :) ...

0

First of all: It's Borland and not Boreland :P, secondly: "as im going to be using it throughout the functions", that's not a real reason to declare your variables globally as you can still pass it to the function as an argument (or pass a pointer to it to a function) :) ...

ok , didnt want to use the pointer. Im just following the teacher still, so.............

0

i would, but cant right now, got to complete this to send up for ma CXC CAPE Internal Assesment

0

Ok i got 3 errors now, and im using Boreland C++. Teacher made me declare the variables globally, as im going to be using it throughout the functions.

How curious... your teacher requires Borland complier and to globally defined variables.

tell me, what school do you go to?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.