Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

AI HAVE ALREADY DONE PHASE ONE AND TWO OF THE PROGRAM OF DATBASE OF STUDENT I NEED TO Add a new array named Courses that

AI HAVE ALREADY DONE PHASE ONE AND TWO OF THE PROGRAM OF DATBASE OF STUDENT I NEED TO Add a new array named "Courses" that contain the course name and add or modify functions to work with the course using its names not its number thnaks in advance

#include

void sumeachstudent(int sdb[5][6],int ssum[5][2]){

for(int i=0;i<5;i++){

ssum[i][0]=sdb[i][0];

int sum=0;

for(int j=1;j<6;j++){

sum+=sdb[i][j];

}

ssum[i][1]=sum;

}

}

int mintotaldegree(int ssum[5][2]){

int index=0,mind=ssum[0][1];

for(int i=1;i<5;i++){

if(ssum[i][1]

index=i;

mind=ssum[i][1];

}

}

return index;

}

int maxdegree(int sdb[5][6],int cno){

int index=0,md=sdb[0][cno];

for(int i=1;i<5;i++){

if(sdb[i][cno]>md){

index=i;

md=sdb[i][cno];

}

}

return index;

}

void printcourp(int sdb[5][6],int cno){

for(int i=0;i<5;i++){

printf("Student id: %d Course degree: %d ",sdb[i][0],sdb[i][cno]);

}

}

void swap(int *x,int *y)

{

int t;

t = *x;

*x = *y;

*y = t;

}

void sort(int ssum[5][2]){

for(int i=0;i<5;i++){

for(int j=i+1;j<5;j++){

if(ssum[i][1]

swap(&ssum[i][1],&ssum[j][1]);

swap(&ssum[i][0],&ssum[j][0]);

}

}

}

}

void searchs(int sdb[5][6],int cno,int ssum[5][2]){

int index=maxdegree(sdb,cno);

for(int i=0;i<5;i++){

if(sdb[index][0]==ssum[i][0]){

printf("Student id for maximum in course %d is %d And the total degree is: %d ",sdb[index][cno],ssum[i][0],ssum[i][1]);

}

}

}

int main(){

int sdb[5][6],ssum[5][2];

printf("In each row first enter the id and than the grades of course in next 5 ");

for(int i=0;i<5;i++){

for(int j=0;j<6;j++){

scanf("%d",&sdb[i][j]);

}

printf(" ");

}

sumeachstudent(sdb,ssum);

printf("Min total degree student id: %d And toal min degree: %d ",ssum[mintotaldegree(ssum)][0],ssum[mintotaldegree(ssum)][1]);

int index=maxdegree(sdb,4);

printf("Max degree student id: %d Max degree in that course: %d ",sdb[index][0],sdb[index][4]);

printcourp(sdb,3);

sort(ssum);

printf("After sorting the total degree ");

for(int i=0;i<5;i++){

printf("Student id: %d Total degree: %d ",ssum[i][0],ssum[i][1]);

}

searchs(sdb,3,ssum);

}

thnak you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago

Question

Question How is life insurance used in a DBO plan?

Answered: 1 week ago