Lesson after lesson.. It's me again guys... just finish the second lab exercise.... hmmm... And now our lesson is about multiple arrays... =) I had already this code here:
That code will total 5 scores. My problem is how to add code so that the program will do something like this:Code:#include <stdio.h> #include <string.h> main() { int score[5][3], total[5]; int st, sc; clrscr(); for(st=0;st<=4;st++) { total[st]=0; for(sc=0;sc<=2;sc++) { scanf("%i",&score[st][sc]); total[st]=total[st]+score[st][sc]; printf("%i",total[st]); } } }
Program:
Enter Student Name: John
Enter 3 Scores of the Student:
10
10
10
(screen clears)
Enter Student Name: Ronald
Enter 3 Scores of the Student:
9
10
9
(screen clears)
Enter Student Name: Karlo
Enter 3 Scores of the Student:
9
8
8
(screen clears)
(Final Output)
Students 1 2 3 Total
John 10 10 10 30
Ronald 9 10 9 28
Karlo 9 8 8 25
John Got the Highest Total Score of 30.
(terminate)
Hmmm... Hope this info helps... Thanks in advance... ^^



LinkBack URL
About LinkBacks




had no idea now....