0% found this document useful (0 votes)
43 views

Project #1 Dsa

The document describes a student management system project implemented in C++. The system allows users to add, search, modify, and delete student records from a linked list. Functions are defined to perform each operation. The main function displays a menu and calls the appropriate function based on the user's selection. Sample output screenshots are also included.

Uploaded by

syed usama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Project #1 Dsa

The document describes a student management system project implemented in C++. The system allows users to add, search, modify, and delete student records from a linked list. Functions are defined to perform each operation. The main function displays a menu and calls the appropriate function based on the user's selection. Sample output screenshots are also included.

Uploaded by

syed usama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

Total Marks:

Obtained Marks:

DSA Lab Project Report

Student Management System

Submitted To: Ms. Tahreem Saboor


_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Student Name: Syed Usama Amjad, M. Faseeh


______________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Reg. Number: 2180134, 2180124


______________________________________________________________________________________________________________________________________________________________________________________________________________________________________

DSA (lab) BSSE-3A SZABIST-ISB


ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

Introduction
In this program, we tried to design Student Management System. C++ is a popular high-level
programming language that is used in a variety of applications. We developed a Student
Management System in which Staff employees can simply enter data about Student
Discipline, Student name and data related to Student that deals with student associated
activities. We use various data types, functions; this code was written entirely in C++. We
employ Structure, and types, data members, if else statements, and cases, as we learned in
class.

Including
1) Add a Student Record.
2) Search a Student Record.
3) Modify a Student Record.
4) Delete a Student Record.
5) Quit Program.
As a result, anyone can use this application because it is so simple

Code:
#include<conio.h>
#include<iostream>
using namespace std;
bool check = true;
struct node //structure of node //
{
char name[20];
char discipline[20];
int rollNo;
char section;
node *next;
}*head,*tail;

void add() //Adds record of student//


{
node *p;
p=new node;
cout<<"Enter name of student:"<<endl;

DSA (lab) BSSE-3A SZABIST-ISB


ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

gets(p->name);
fflush(stdin);
cout<<"Enter discipline of student:"<<endl;
gets(p->discipline);
fflush(stdin);
cout<<"Enter Roll Number of student:"<<endl;
cin>>p->rollNo;
fflush(stdin);
cout<<"Enter section of student:"<<endl;
cin>>p->section;
fflush(stdin);
p->next=NULL;

if(check)
{
head = p;
tail = p;
check = false;
}
else
{
tail->next=p;
tail=p;
}
cout<<endl<<"Recored Entered";
cout<<"\nPress any key to get back to the Menu "<<endl;
getch();
}
void modify() //modifies record of student//
{
node *ptr;
node *prev=NULL;
node *current=NULL;
int roll_no;
cout<<"Enter Roll Number to search:"<<endl;
cin>>roll_no;
prev=head;
current=head;
while(current->rollNo!=roll_no)
{
prev=current;

DSA (lab) BSSE-3A SZABIST-ISB


ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

current=current->next;
}
ptr=new node;
fflush(stdin);
gets(ptr->name);
fflush(stdin);
cout<<"Enter discipline of student:"<<endl;
gets(ptr->discipline);
fflush(stdin);
cout<<"Enter Roll Number of student:"<<endl;
cin>>ptr->rollNo;
fflush(stdin);
cout<<"Enter section of student:"<<endl;
cin>>ptr->section;
fflush(stdin);
prev->next=ptr;
ptr->next=current->next;
current->next=NULL;
delete current;
cout<<endl<<"Recored Modified";
cout<<"\nPress any key to get back to the Menu "<<endl;

getch();
}
void search() //searches record of student//
{
node *prev=NULL;
node *current=NULL;
int roll_no;
cout<<"Enter Roll Number to search:"<<endl;
cin>>roll_no;
prev=head;
current=head;
while(current->rollNo!=roll_no)
{
prev=current;
current=current->next;
}
cout<<"\nname: ";
puts(current->name);
cout<<"\nRoll No:";

DSA (lab) BSSE-3A SZABIST-ISB


ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

cout<<current->rollNo;
cout<<"\nDiscipline:";
puts(current->discipline);
cout<<"\nSection:";
cout<<current->section;
getch();
}
void del() //deletes record of a student//
{
node *ptr=NULL;
node *prev=NULL;
node *current=NULL;
int roll_no;
cout<<"Enter Roll Number to Delete:"<<endl;
cin>>roll_no;
prev=head;
current=head;
while(current->rollNo!=roll_no)
{
prev=current;
current=current->next;
}
prev->next = current->next;
current->next=NULL;
delete current;
cout<<endl<<"Recored Deleted";
cout<<"\nPress any key to get back to the Menu "<<endl;

getch();
}

int main()
{
char x;
cout<<"\t\t *************************** \t\t\t"<<endl;
cout<<"\t\t *STUDENT MANAGEMENT SYSTEM* \t\t\t"<<endl;
cout<<"\t\t *************************** \t\t\t"<<endl;

cout<<"\n\nPress Any Key To Continue . . . ."<<endl;

getch();

DSA (lab) BSSE-3A SZABIST-ISB


ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

cout<<" LOADING *****"<<endl;

do
{
system("cls");
cout<<"1--->Press '1' to add New record:"<<endl;
cout<<"2--->Press '2' to search a record:"<<endl;
cout<<"3--->Press '3' to modify a record:"<<endl;
cout<<"4--->Press '4' to delete a record:"<<endl;
cout<<"5--->Press '5' to exit:"<<endl;
x=getch();
if(x=='1')
{
system("cls");
add();
}
else if(x=='2')
{
system("cls");
search();
}
else if(x=='3')
{
system("cls");
modify();
}
else if(x=='4')
{
system("cls");
del();
}
else if(x=='5')
{
exit(0);
}
else
{
}
}while(x != 27);
getch();
}

DSA (lab) BSSE-3A SZABIST-ISB


ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

Output / Screenshot:

DSA (lab) BSSE-3A SZABIST-ISB


ShaheedZulfikar Ali Bhutto Institute of Science & Technology

COMPUTER SCIENCE DEPARTMENT

DSA (lab) BSSE-3A SZABIST-ISB

You might also like