adspace


write a program on link list to get information about
graduated students?

Answer Posted / Gaurav Ankur

Creating a program to store and retrieve information about graduates using linked lists can vary greatly depending on the programming language. Here's an example in C++:n```cppn#include <iostream>nusing namespace std;nnstruct Student {n int id;n string name;n string degree;n string graduationYear;n struct Student* next;n};nnvoid addStudent(struct Student** head, struct Student* newStudent) {n if (*head == NULL) {n *head = newStudent; n return ;n }n struct Student* temp = *head;n while (temp->next != NULL) {n temp = temp->next;n }n temp->next = newStudent;n }nnvoid displayStudents(struct Student* head) {n if (head == NULL) {n cout << "List is empty." << endl; n return ;n }n struct Student* temp = head;n while (temp != NULL) {n cout << "ID: " << temp->id << "n Name: " << temp->name << "n Degree: " << temp->degree << "n Graduation Year: " << temp->graduationYear << endl;n temp = temp->next;n }n }nnint main() {n struct Student* head = NULL; n struct Student newStudent1 = {n 1,n "John Doe",n "Bachelor of Science in Computer Science",n "2020"};n struct Student newStudent2 = {n 2,n "Jane Smith",n "Master of Business Administration",n "2018"};n addStudent(&head, &newStudent1);n addStudent(head->next, &newStudent2);n displayStudents(head);n return 0;n }n```

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Dear sir i need central bank of india clerical grade last three year question papers. Kindly forward to my email id gsmaliniraj@yahoo.co.in, malinisankaram@gmail.com

2181


The following character string is to be transmitted: ABADADAD i. Derive the Huffman and Dynamic Huffman tree codes ii. Determine the savings in transmission bandwidth for both over normal ASCII coding.Write down the actual transmitted bit patterns corresponding to both

1795


Dear sir i need lic model question paper for the last two years, Kindly forward solved question papers to my mail id gsmaliniraj@yahoo.co.in, malinisankaram@gmail.com

2398


hi sir plz send me clerical exams model test papers for the preperation of indian bank exam am very thankful to you

2026


Shall i get Section engineer S & T question paper? (Railway recruitment board)

2722


For measuring weight of 2cm3 piece of density 4gm/cm3 which spring balance is best suited what is the range and least count how we calculate

1771


dear sir i need rrb chennai Section engineer S & T for last 2 year question papers. Plz send my email id is gsmaliniraj@yahoo.co.in, malinisankaram@gmail.com

2128