C++ Store Details of a Student in Linked list

Store Details of a Student in Linked list

Hello in this program you will learn how to Store Details of a Student in Linked list, also we learn to process them with an Action Button.

Before understanding this Program, you should have knowledge about the following topics.

Circular Linked list

Linked list simple program

C++ Program to Store Details

#include <iostream>

using namespace std;

class sNode{
string Name;
string rollNo;
sNode *next;


class LinkedList{
sNode *head;

head = nullptr;

void insert_at_beginning(string name, string rNo ){
sNode *temp = new sNode();
temp->Name = name;
temp->rollNo = rNo;
temp->next = head;
head = temp;

void print(){
if (head == NULL){
cout<<"List is empty"<<endl;
sNode *temp = head;
cout<<"Linked List: "<<endl;

while (temp != NULL){
temp = temp->next;

int main()

cout<<"1 to Insert at the beginning"<<endl;
cout<<"2 to Display"<<endl;
cout<<"3 to Exit"<<endl;

int choice,v,p;
string n,r;
LinkedList ll;

do {
cout<<"\nEnter Your Choice: ";
switch (choice)
case 1:
cout<<"Enter Name: ";
cout<<"Enter RollNO: ";
case 2:

} while (choice != 3);

cout<<"program Ends";
return 0;

Student DataBase system in Cpp


Here the program will provide you 3 Options.

1 to Insert at the beginning

2 to Display

3 to Exit

Enter Your Choice:

Now we’re giving commands to the executive programs.

Enter Your Choice: 1

Enter Name: JACK

Enter RollNO: 12

After submitting it will represent choice, now we’ll enter our choice again for Displaying.

Enter Your Choice: 2

Linked List:

Name    RollNo

JACK        12

After Displaying the data, again it will provide an Option for next. But we saw there is a 3 option for Exit, so we choose 3.

Enter Your Choice: 3

Program Finished

Red represents User Inputted Value.

♥Blue Represent compiler Output.

When you enter option 2, then it will displayed you a msg like “List is Empty

C++ Program to Store Information of a Student in a Linked list

Store Details of a Student in Linked list
Store Details of a Student in Linked list


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.