Write a menu driven program to create a linked list of a class
of students and perform the following
operations:
a. Write out the contents of the list
b. Edit the details pf a specified student
c. Count the number of students above 21 years and 55 kg weight
C CODE:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct Student
{
char name[20];
int weight;
int age;
struct Student *next;
};
struct Student *insert(struct Student *head,char n[20],int w,int
a)
{
struct Student *newnode=(struct Student *)malloc(sizeof(struct
Student));
strcpy(newnode->name,n);
newnode->weight=w;
newnode->age=a;
newnode->next=NULL;
if(head==NULL)
{
head=newnode;
return head;
}
struct Student *temp=head;
while(temp->next!=NULL)
temp=temp->next;
temp->next=newnode;
return head;
};
void print(struct Student *head)
{
struct Student *temp=head;
while(temp!=NULL)
{
printf("Name: %s Weight: %d Age:
%d\n",temp->name,temp->weight,temp->age);
temp=temp->next;
}
}
struct Student *edit(struct Student *head)
{
printf("Enter name of student to edit: ");
char n[20];
scanf("%s",n);
struct Student *p;
p=head;
int f=0;
while(p!=NULL)
{
if(strcmp(p->name,n)==0)
{
f=1;
break;
}
p=p->next;
}
if(f==0)
printf("Student not found\n");
else
{
printf("Enter new name: ");
char m[20];
scanf("%s",m);
printf("Enter new age: ");
int a;
scanf("%d",&a);
printf("Enter new weight: ");
int w;
scanf("%d",&w);
strcpy(p->name,m);
p->age=a;
p->weight=w;
}
return head;
}
void count(struct Student *head)
{
struct Student *p=head;
int count=0;
while(p!=NULL)
{
if(p->age>21&&p->weight>55)
count++;
p=p->next;
}
printf("Total Students above 21 years age and 55 kg weight:
%d\n",count);
}
int main()
{
struct Student *head =NULL;
head=insert(head,"John",60,22);
head=insert(head,"David",70,21);
head=insert(head,"Jonny",54,22);
while(1)
{
printf("1: Print List\n");
printf("2: Edit List\n");
printf("3: Count students above 21 years age and 55 kg
weight\n");
printf("4: Exit\n");
printf("Enter choice: ");
int n;
scanf("%d",&n);
if(n==1)
print(head);
else if(n==2)
head=edit(head);
else if(n==3)
count(head);
else if(n==4)
break;
else
printf("Wrong choice\n");
}
return 0;
}
Output:

Write a menu driven program to create a linked list of a class of students and...
Write a menu-driven program to read a list of students’ surnames and perform the following: a) Print the initial list of surnames b) Sort the surnames in ascending order and print the sorted list c) Sort the surnames in descending order and print the sorted list. using c programing and write its flow chat.through user input.
Assignment Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students...
Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students Q...
Create a linked list with the following features. A Node class that stores the data type of your choice. A constructor that creates a dummy header node. void display() -- A method for printing the list. void add(item) -- A method for adding a value to the beginning of the list void addEnd(item) -- A method of adding a value to the end of the list. bool contains(item) -- A method for finding a specified value in the list. int...
Write a c/c++ program to read a list of students from a file and create a list. The program should use a linked list for implementation. Each node in the linked list should have the student’s name, a pointer to the next student, and a pointer to a linked list of scores. There may be up to four scores for each student.
FOR JAVA: Summary: Create a program that adds students to the class list (list below). The solution should be named Roster402_v2.java. Allow the user to control the number of students added to the roster. Ask if the user would like to see their new roster to confirm additions. If yes, then display contents of the file, if no, end the program. ------------------------------------------------------------------------------------- List of student names and IDs for class (this will be your separate text file): Jones, Jim,45 Hicks,...
At this time, you need to create menu driven program. The menu includes the following list. The menu should keep showing if a wrong choice is selected until one of the choices of 1 to 4 is selected. After each of the options 1 to 3 is done, the program shows the menu and waits for the user's choice. Upload your code here. 1. Add odd numbers from a to b 2. Add even numbers from a to b 3....
C++ Data Structure Write a program to read a list of students from a file and create a list. The program should use a linked list for implementation. Each node in the linked list should have the student’s name, a pointer to the next student, and a pointer to a linked list of scores. There may be up to four scores for each student.
In C++
Write a menu driven C++ program to read a file containing
information for a list of Students, process the data, then present
a menu to the user, and at the end print a final report shown
below. You may(should) use the structures you developed for the
previous assignment to make it easier to complete this assignment,
but it is not required.
Required Menu Operations are:
Read Students’ data from a file to update the list (refer to
sample...
Write a program that will maintain a personal phonebook. The program should be menu driven. Create a new phonebook Print the phonebook Add person to the phonebook Remove a person from the phonebook Sort Modify a person Search for a person by name Save to a data file (Can't be done but leave an error message if the user selects) Retreive phonebook from data file (Can't be done but leave an error message if the user selects) Quit Create a...