You are on page 1of 3

#include<stdio.h> #include<conio.

h> void record(); void score(); void search(); int main() { clrscr(); record(); { clrscr(); score(); } getch(); return 0; } struct record{ char name[20]; int id; int ylevel; int score[3]; //char course[10]; }s_record[2]; void record() { int x,p=0; for(x=0;x<2;x++) { printf("enter your name: "); scanf("%s",&s_record[x].name);

Abdul Malik Abtahi Freche Galapon Ivy Tupas Dweezil Kitz Mahipus Benje Letigio Neil Lawrence Naniong Israel Cortez Reymond Avanzado

printf("Enter ID number: "); do{ scanf("%d",&s_record[x].id); }while(s_record[x].id <0 || s_record[x].id > 999);

do{ printf("Enter year level: "); scanf("%d",&s_record[x].ylevel); }while(s_record[x].ylevel<1 || s_record[x].ylevel>4); printf("\n"); } } void score() { int stdid,n,l,y = 0; // char choice; //do{ printf("enter id: "); scanf("%d",&stdid) ; do { if(stdid == s_record[y].id) { for(n=0;n<3;n++) { do{ printf("enter your score %d: ",n+1); scanf("%d",&s_record[y].score[n]); }while(s_record[y].score[n] <0 || s_record[y].score[n] > 100);

} printf("the score is %d ",s_record[y].score[1]); break; } y++; } while(stdid<s_record[y].id || stdid>s_record[y].id);

printf("the names you inputted:\n\n "); for(l=0;l<2;l++) { printf(" %s\n",s_record[l].name);

} // printf("\ndo you want to enter again? Y/N ?"); // scanf("%c",&choice); //} while(choice == 'Y' || choice == 'y');

You might also like