i want my variable (j) to be various and make sure the loop runs from the point of view of (j) which can be any number causing it to repeat any help ??!!
and how would i go about making the module grade and id print the result with my function and a grade point value
and also make it do calculation like Grade point value and total module credits 5 per subject...Which there are twelve
Code:
#include <stdlib.h>
struct input{
char fname[12];
char lname[12];
char studentid[10];
char moduleid[10];
float modulegrade;
};
void Grade(struct input data);
void GPV(struct input data);
int main()
{
int i,j;
struct input words[120];
struct input data[15];
printf("*-----------Welcome To The GPA CALCULATOR----------*");
printf("\n \nHow Many students would you like to enter: ");
scanf("%d",&j);
for(j=0;j<100;j++)
{
printf("\n\nEnter The First Name & Last Name & Student ID:\n");
scanf("%s %s %s",words[j].fname,words[j].lname,words[j].studentid);
for(i=0;i<12;i++)
{
printf("\n\nEnter The Module ID & Module Grade Achieved:\n");
scanf("%s %f",data[i].moduleid,&data[i].modulegrade);
}
}
Grade(data[i]);
return 0;
}
void Grade(struct input data )
{
if ((data.modulegrade >80) &&(data.modulegrade <=100))
{
printf("A");
}
if ((data.modulegrade >70) &&(data.modulegrade <= 79))
{
printf("B+");
}
if ((data.modulegrade >60) &&(data.modulegrade <=69))
{
printf("B");
}
if ((data.modulegrade >55) &&(data.modulegrade <=59))
{
printf("B-");
}
if ((data.modulegrade >50) &&(data.modulegrade <= 54))
{
printf("C+");
}
if ((data.modulegrade >40) &&(data.modulegrade <= 49))
{
printf("C");
}
if ((data.modulegrade >35) &&(data.modulegrade <=39))
{
printf("D");
}
if (data.modulegrade <35 )
{
printf("F");
}
return ;
}