int i, exam, maxExam - 0, choice- 0, course_no; int total_stu[10001={0); printf("------ printf("\n Thia program is used to read and obtain information "): printf("\n# from the student registered courses text file printf("\n---- ---"): "): --): printf("\nEnter the file name to open: "); scanf ("ta",sfile_name) : if (input=fopen (file_name, while (!feof (input)) read from file*/ fscanf (input, "td".5 total_stu(exam] - total_stu[exam] + 1 if (exam > maxExam) maxExam - 6 ; printf("\n0 - exit"); printf ("\nl - the maximum no of courses"); printf("\n2 - number of student for a particular courses"); printf("\n3 - Write the total number of students into a text file (*.txt)"); printf("\n\nEntered your choice: "); scanf ("d", Jelsel printf ("Cannot open file name exit (-1) ; while (choice !- 0) ( if (choice - 1) totalCourse if (choice -- 2){ course no if (course_no <- maxExam) {

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Below is a source code of an non-working program. Fix the holes in this program.theres's 20 holes in the program just list the needed program.pls and thank you

Photos - Quiz4.png 42%
A See all photos
+ Add to
* Edit & Create v
IA Share
...
#include <stdio.h>
#include <conio.h>
void totalcourse (1);
2 specificCourse (void);
main ()(
char file name [15];
int i, exam, maxExam - 0, choice - 0, course_no;
FILE
char str[20];
int total_stu[1000]-{0};
printf ("----
printf ("\n# This program is used to read and obtain information #");
printf ("\n# from the student registered courses text file
printf ("\n-----
-----"):
");
-");
printf ("\nEnter the file name to open: ");
scanf ("%s", &file_name);
if (input=fopen (file_name, 4)){
while (!feof (input)) / read from file*/
fscanf (input, "%d",5
total_stu[exam] = total stu[exam] + 1;
if (exam > maxExam)
maxExam =
6
printf("\n0 - exit");
printf ("\nl - the maximum no of courses");
printf("\n2 - number of student for a particular courses");
printf ("\n3 - Write the total number of students into a text file (*.txt)");
printf("\n\nEntered your choice: ");
scanf ("d",
Jelse{
printf("Cannot open file name $s",
exit (-1);
7 ):
8
while (choice != 0) {
if (choice == 1){
totalCourse
9.
;}
if (choice -- 2) (
10
course_no -
if (course no <- maxExam) {
--- E IH
1:33 AM
24°C Clear
29/1/2022
o
Transcribed Image Text:Photos - Quiz4.png 42% A See all photos + Add to * Edit & Create v IA Share ... #include <stdio.h> #include <conio.h> void totalcourse (1); 2 specificCourse (void); main ()( char file name [15]; int i, exam, maxExam - 0, choice - 0, course_no; FILE char str[20]; int total_stu[1000]-{0}; printf ("---- printf ("\n# This program is used to read and obtain information #"); printf ("\n# from the student registered courses text file printf ("\n----- -----"): "); -"); printf ("\nEnter the file name to open: "); scanf ("%s", &file_name); if (input=fopen (file_name, 4)){ while (!feof (input)) / read from file*/ fscanf (input, "%d",5 total_stu[exam] = total stu[exam] + 1; if (exam > maxExam) maxExam = 6 printf("\n0 - exit"); printf ("\nl - the maximum no of courses"); printf("\n2 - number of student for a particular courses"); printf ("\n3 - Write the total number of students into a text file (*.txt)"); printf("\n\nEntered your choice: "); scanf ("d", Jelse{ printf("Cannot open file name $s", exit (-1); 7 ): 8 while (choice != 0) { if (choice == 1){ totalCourse 9. ;} if (choice -- 2) ( 10 course_no - if (course no <- maxExam) { --- E IH 1:33 AM 24°C Clear 29/1/2022 o
Photos - Quiz4.png 42%
A See all photos
+ Add to
* Edit & Create v
IA Share
...
if (choice -- 2) {
10
course no -
if (course no <- maxExam)
printf ("\n--> Course %d = 8d numbers of registered student\n",
13
printf ("\n --> INVALID number of course");}
11
12
//write to a txt file
if 14
printf("\nEnter the file name to create\\write : ");
scanf ("%s", &file name);
input
for (i = 1; i <- maxExam; i++) {
fprintf (input,"\ncourse %d: %d",i,
fclose (input);
printf("\n --> The total number of students in each courses is created in O", file name);
== 3)(
15file name, "a+") ; /*read the file*/
16
17
printf("\n----
printf("\no - exit");
printf("\nl - the maximum no of courses");
printf ("\n2 - number of student for a particular courses");
printf("\n3 - Write the total number of students in each courses into a text file (*.txt)");
printf("\n\nEntered your choice: ");
scanf ("sd", &choice);
");
printf ("\n ------ Thank you ------\n");
18(input);/*close the file*/
void totalcCourse (int maxExam)
{
printf ("\n--> Maximum no of courses = &d\n",
19):
int specificCourse (void)
int course;
printf ("Enter course number: ");
scanf ("d", &course);
return
20
1:33 AM
24°C Clear
29/1/2022
of
Transcribed Image Text:Photos - Quiz4.png 42% A See all photos + Add to * Edit & Create v IA Share ... if (choice -- 2) { 10 course no - if (course no <- maxExam) printf ("\n--> Course %d = 8d numbers of registered student\n", 13 printf ("\n --> INVALID number of course");} 11 12 //write to a txt file if 14 printf("\nEnter the file name to create\\write : "); scanf ("%s", &file name); input for (i = 1; i <- maxExam; i++) { fprintf (input,"\ncourse %d: %d",i, fclose (input); printf("\n --> The total number of students in each courses is created in O", file name); == 3)( 15file name, "a+") ; /*read the file*/ 16 17 printf("\n---- printf("\no - exit"); printf("\nl - the maximum no of courses"); printf ("\n2 - number of student for a particular courses"); printf("\n3 - Write the total number of students in each courses into a text file (*.txt)"); printf("\n\nEntered your choice: "); scanf ("sd", &choice); "); printf ("\n ------ Thank you ------\n"); 18(input);/*close the file*/ void totalcCourse (int maxExam) { printf ("\n--> Maximum no of courses = &d\n", 19): int specificCourse (void) int course; printf ("Enter course number: "); scanf ("d", &course); return 20 1:33 AM 24°C Clear 29/1/2022 of
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY