Based on the source code and output given above write an
introduction, objective and Statement of the problem.
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 int main() 9 { 10 FILE *stinfo; 11 stinfo=fopen("Student_information.txt","r"); 12 assert(stinfo!=NULL); 13 14 15 puts("\nStudent information\n"); 16 int count=1; 17 char_name_buf[100],stdnum_buf[100],year_buf[100],bday_buf[100],add_buf [100] 18,con_buf[100], 19 emername_buf[100], emercon_buf [100]; 20 char st[3] = "st"; 21 while (1) 22 { 23 char* success=fgets(name_buf, 100,stinfo); 24 if (success==NULL) break; 25
26 fgets(stdnum_buf, 100,stinfo); 27 fgets (year_buf,100,stinfo); 28 fgets (bday_buf, 100,stinfo); 29 fgets (add_buf, 100,stinfo); 30 fgets (con_buf, 100,stinfo); 31 fgets (emername_buf, 100,stinfo); 32 fgets (emercon_buf, 100,stinfo); 33 34 35 printf("The %d %s Student Name: %s",count,st,name_buf); 36 printf("The %d %s Student Number: %s",count,st, stdnum_buf); 37 printf("The %d %s Student Year level: %s",count,st, year_buf); 38 printf("The %d %s Student Birthday: %s",count,st, bday_buf); 39 printf("The %d %s Student Contact Number: %s",count,st,con_buf); 40 printf("Emergency Contact Details\n"); 41 printf("The %d %s Student Emergency Contact Name: %s",count,st, emername_buf); 42 printf("The %d %s Student Emergency Contact Number: %s", count,st, emercon_buf); 43 44 if(strcmp(st,"st")==0){ strcpy(st, "nd"); printf("\tProcess %d.\n",getppid()); 48 else if (strcmp(st,"nd")==0){ 3 4 45 46 47
49 strcpy(st, "rd"); 50 printf("\tProcess %d.\n",getpid()); } 51 52 else if (strcmp(st,"rd")==0){ 53 strcpy(st,"th"); 54 printf("\tProcess %d.\n",getppid()); 55 } 56 count++; 57 getchar(); 58 59 60} 61 fclose(stinfo); 62}
giann@giann-VirtualBox:~$ ./exp81 Student information The 1st Student Name: Bering Labra The 1st Student Number: 2011231231 The 1st Student Year level: 4 The 1st Student Birthday: April 9, 1993 The 1st Student Contact Number: 0956559232 Emergency Contact Details The 1st Student Emergency Contact Name: Junny Labra The 1st Student Emergency Contact Number: 09542319434 Process 283876. The 2nd Student Name: Engolbert Madlantuta The 2nd Student Number: 2009878293 The 2nd Student Year level: 4 The 2nd Student Birthday: May 1, 1855 The 2nd Student Contact Number: 09235234982 Emergency Contact Details The 2nd Student Emergency Contact Name: Tiburcio Madlantuta The 2nd Student Emergency Contact Number: 09582319322 Process 284390.
Based on the source code and output given above write an introduction, objective and Statement of the problem.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am