0% found this document useful (0 votes)
3 views12 pages

Project

The document outlines a Vendor Management System and HR Management System, including a menu structure for managing vendors. It also contains C++ code for a linked list implementation, featuring functions to insert, delete, and display nodes in the list. The code demonstrates basic operations on a linked list, including handling edge cases for deletion.

Uploaded by

manmeetsingh0306
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)
3 views12 pages

Project

The document outlines a Vendor Management System and HR Management System, including a menu structure for managing vendors. It also contains C++ code for a linked list implementation, featuring functions to insert, delete, and display nodes in the list. The code demonstrates basic operations on a linked list, including handling edge cases for deletion.

Uploaded by

manmeetsingh0306
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/ 12

Vendor Management System

HR Management System
CMS / SCRM

Column list for form (input columns)


Workflow
Flowchart
Working Analysis

Menu SAP
1. Vendor
Add Vendor
View Vendor
Edit Vendor
Approved Vendor
2. HR
#include <iostream>
using namespace std;

class Node {
public:
int data;
Node * next;
};

void insert(Node ** head, int data) {

Node * newNode = new Node();

newNode -> data = data;


newNode -> next = * head;

//changing the new head to this freshly entered node


* head = newNode;

}
void deletenode(Node ** head, int delVal) {
Node * temp = new Node();
temp = * head;
Node * previous = new Node();

//Case when there is only 1 node in the list


if (temp -> next == NULL) {
* head = NULL;
delete(temp);
cout << "Value deleted: " << delVal << endl;
return;
}
//if the head node itself needs to be deleted
if (temp != NULL && temp -> data == delVal) {
//Case 1 head becomes 30
* head = temp -> next; //changing head to next in the list

cout << "Value deleted: " << delVal << endl;


//case 1: 22 deleted and freed
delete(temp);
return;
}

//run until we find the value to be deleted in the list


while (temp != NULL && temp -> data != delVal) {
//store previous link node as we need to change its next
val
previous = temp;
temp = temp -> next;
}

//if value is not present then


//temp will have traversed to last node NULL
if (temp == NULL) {
cout<< "Value not found\n";
return;
}

// Case 2: (24)->next = 16 (as 20->next = 16)


// Case 3: (16)->next = NULL (as 12->next = NULL)
previous -> next = temp -> next;
delete(temp);

//case 2: 20 deleted and freed


//case 3: 12 deleted and freed
cout << "Value deleted: " << delVal << endl;
}

void display(Node * node) {

//as linked list will end when Node is Null


while (node != NULL) {
cout << node -> data << " ";
node = node -> next;
}
cout << endl;
}

int main() {
Node * head = NULL;
/*Need & i.e. address as we
need to change head address only needs to traverse
and access items temporarily
*/
insert( & head, 12);
insert( & head, 16);
insert( & head, 20);
insert( & head, 24);
insert( & head, 30);
insert( & head, 22);

/*No need for & i.e. address as we do not


need to change head address
*/
cout<< "Linked List Before Operations : ";
display(head);

//deleting first occurance of a value in linked list


deletenode( & head, 22);
deletenode( & head, 20);
deletenode( & head, 12);

cout<< "Linked List After Operations : ";

display(head);
return 0;
}
#include <iostream>
using namespace std;

class Node {
public:
int data;
Node * next;
};

int calcSize(Node * node) {


int size = 0;

while (node != NULL) {


node = node -> next;
size++;
}
return size;
}

void insert(Node ** head, int data) {


Node * newNode = new Node();

newNode -> data = data;


newNode -> next = * head;

//changing the new head to this freshly entered node


* head = newNode;

}
void deletenode(Node ** head, int pos) {
Node * temp = * head;
Node * previous;

//if the head node itself needs to be deleted


int size = calcSize( * head);

if (pos < 1 || pos > size) {


cout << "Enter valid position\n";

return;
}
if (pos == 1) {
//Case 1 head becomes 30
* head = temp -> next; //changing head to next in the list
cout << "Value deleted: " << temp -> data << endl;

//case 1: 22 deleted and freed


delete(temp);
return;
}

//run until we find the value to be deleted in the list


while (--pos) {
//store previous link node as we need to change its next
val
previous = temp;
temp = temp -> next;
}

// Case 2: (24)->next = 16 (as 20->next = 16)


// Case 3: (16)->next = NULL (as 12->next = NULL)
previous -> next = temp -> next;
cout << "Value deleted: " << temp -> data << endl;
delete(temp);
//case 2: 20 deleted and freed
//case 3: 12 deleted and freed
}

void display(Node * node) {


cout << endl;

//as linked list will end when Node is Null


while (node != NULL) {
cout << node -> data << " ";
node = node -> next;
}
cout << endl;
}

int main() {
Node * head = NULL;
/*Need & i.e. address as we
need to change head address only needs to traverse
and access items temporarily
*/
insert( & head, 12);
insert( & head, 16);
insert( & head, 20);
insert( & head, 24);
insert( & head, 30);
insert( & head, 22);

/*No need for & i.e. address as we do not


need to change head address
*/
display(head);

//deleting first occurance of a value in linked list


deletenode( & head, 1);
display(head);

deletenode( & head, 3);


display(head);

deletenode( & head, 4);


display(head);
deletenode( & head, -2);
deletenode( & head, 10);
return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy