Computer Science, asked by mdevika2604, 10 months ago

A node in a Singly Linked List consists of following
information with respect to colleges: college name, year
of establishment, number of branches and number of
students. Develop a C program using functions to
perform the following operations on this list:
i) Insert a new college at the beginning of the list
ii) List all the colleges established after 1970
iii) Search for a specified college and update the number
of branches​

Answers

Answered by swagatodebnath
0

your doctor may be a little too late 3in 2but it to you have a

Answered by pesh20gathoni
1

Answer:

  #include <stdio.h>

struct collage{

   char c_name[50];

   int year_of_e;

   int no_of_branch;

   int no_of_student;

} s;

int main() {

add:

char c;

do

{

   printf("Please enter first collage details as per below:\n");

   printf("Enter the name of the collage: ");

   fgets(s.c_name, sizeof(s.c_name), stdin);

   printf("Enter the year of establishment of collage : ");

   scanf("%d", &s.year_of_e);

   printf("Enter the number of branches : ");

   scanf("%d", &s.no_of_branch);

   printf("Enter the number of students : ");

   scanf("%d", &s.no_of_student);

   printf("Do you want to add more collages ? Y/N ")

   scanf("%c", &c)

} while( c == 'N')

   do{  

   printf("\nEnter your choice.");

   printf("\n\n 1. Insert a new college.");

printf("\n\n2. List all the colleges established after 1970\n");

printf("\n3. Search for a specified college and update the number of banches​\n");  

   scanf("%d",&choice);  

   switch(choice)  

   {  

       case 1 :  

       goto add;

       break;  

       case 2:    

       display();

       break;  

       case 3:  

       display("1970");  

       break;  

       default:  

       printf("please input the valid choice");      

   }  

   printf("want to enter more?");  

   scanf("%d",&dummy);  

   scanf("%c",&c);  

   }

while(c=='y');

void display(int year)

{

printf("information of collage");

printf("Name of collage : ");

   printf("%s", s.c_name);

   printf("Number of branches : %d\n", s.no_of_branch);

   printf("year of establishment : %d\n", s.year_of_e);

   printf("number of students : %d\n", s.no_of_student);

}

    return 0;

}

Explanation:

Above program will take first collage information and then show the menu of given options.

Similar questions