Professional Documents
Culture Documents
Student Management System
Student Management System
#include<conio.h>
#include<fstream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<Cstdio>
using namespace std;
class Node
{
public:
int roll_no, Phone_no;
string Name,Father_Name;
string Course , quali ;
Node *next_add;
};
class linked_list
{
public:
Node *head = NULL;
void Insert()
{
fstream file;
file.open("Items.txt",ios::app);
int r;
string n;
string c;
string e;
int ph;
file<<new_Node->roll_no<<"\n"<<endl;
file<<new_Node->Name<<"\n"<<endl;
file<<new_Node->Course<<"\n"<<endl;
file<<new_Node->quali<<"\n"<<endl;
file<<new_Node->Phone_no<<"\n"<<endl;
file.close();
if(head==NULL)
{
head =new_Node;
}
else
{
Node *ptr=head;
while(ptr->next_add != NULL)
{
ptr = ptr->next_add;
}
ptr->next_add=new_Node;
}
cout<<"\n\n new Node Inserted Successfully"<<endl;
}
void Search()
{
if(head==NULL)
{
cout<<"\n\n Linked list is Empty"<<endl;
}
else
{
int r,found=0;
cout<<"\n\n Enter Student id for search"<<endl;
cin>>r;
Node *ptr= head;
while(ptr != NULL)
{
if(r == ptr -> roll_no)
{
cout<<"\n\n Student Id:"<<ptr->roll_no<<endl;
cout<<"\n\n Student Name:"<<ptr->Name<<endl;
cout<<"\n\n Student Father_Name:"<<ptr->Course<<endl;
cout<<"\n\n Student Qualification:"<<ptr->quali<<endl;
cout<<"\n\n Student Phone No:"<<ptr->Phone_no<<endl;
found++;
}
void Count()
{
if(head==NULL)
{
cout<<"Linked list is Empty"<<endl;
}
else
{
int c=0;
Node *ptr=head;
while(ptr!=NULL)
{
c++;
ptr =ptr->next_add;
}
cout<<"\n\n Total Numbers of Records:"<<c<<endl;
}
}
void Update()
{
if(head==NULL)
{
cout<<"Linked list is Empty"<<endl;
}
else
{
int r,found=0;
cout<<"\n\n Enter Student Id for Updation"<<endl;
cin>>r;
Node *ptr=head;
while(ptr!=NULL)
{
if(r == ptr -> roll_no)
{
cout<< "\n\n Enter New Student Id" <<endl;
cin>>ptr->roll_no;
cout<< "\n\n Enter New Student Name" <<endl;
cin>>ptr->Name;
cout<< "\n\n Enter New Student Father Name"
<<endl;
cin>>ptr->Course;
ptr=ptr->next_add;
}
if(found==0)
{
cout<<" Update Student Id"<<r<<"can't Found"<<endl;
}
}
}
void Delete()
{
if(head==NULL)
{
cout<<"Linked list is Empty"<<endl;
}
else
{
int r,found=0;
cout<<"\n\n Enter Student Id for deletion"<<endl;
cin>>r;
if(r==head->roll_no)
{
Node *ptr=head;
head = head->next_add;
cout<< "Record Deleted Successfully" <<endl;
found++;
delete ptr;
}
else
{
Node *pre=head;
Node *ptr=head->next_add;
while(ptr!=NULL)
{
if(r=ptr->roll_no)
{
pre->next_add = ptr->next_add;
}
}
}
void Show()
{
if(head==NULL)
{
cout<<"\n\n Linked list is Empty"<<endl;
}
else
{
Node *ptr=head;
while(ptr!=NULL)
{
cout<< "\n\n Student Id =" << ptr->roll_no <<endl;
cout<< "\n\n Student Name =" <<ptr->Name<<endl;
cout<< "\n\n Student Father Name =" << ptr->Course <<endl;
cout<< "\n\n Student Course =" <<ptr-> quali <<endl;
cout<< "\n\n Student PhoneNumber =" << ptr->Phone_no <<endl;
ptr=ptr->next_add;
}
}
}
void Showfile()
{
string s1;
string s2;
string s3;
string s4;
string s5;
string s6;
string s7;
string s8;
string s9;
string s10;
string s11;
string s12;
ifstream ln("Items.txt");
getline(ln,s1);
getline(ln,s2);
getline(ln,s3);
getline(ln,s4);
getline(ln,s5);
getline(ln,s6);
getline(ln,s7);
getline(ln,s8);
getline(ln,s9);
getline(ln,s10);
getline(ln,s11);
getline(ln,s12);
}
};
int main()
{
linked_list obj;
P:
system("cls");
int choice;
cout<<"\n\n\t\t\t\t.................. WELCOME TO STUDENT MANAGMENT
SYSTEM .....................";