Complete this C++ code with the following requirements:  Write a program that will allow a user to enter students into a database. The student information should include full name, student ID, GPA and status. The program should allow delete any student based on student ID. Program must use linked list. No vectors or arrays. C++.   # include using namespace std; class Node{     string full_name, status;     int studentID;     float GPA;     Node* next; }; Node* head= new Node(); bool check (int x){     if(head==NULL){         return false;     }     Node* t=new Node();     t=head;     while(t!=NULL){         if(t->studentID==x){             return true;             t=t->next;         }     }     return false; } void insert(int studentID, string full_name, string status, float GPA){     if(check(student_id)){         cout<<"Student already exists in the record"<studentID=studentID;     t->full_name=full_name;     t->GPA=GPA;     t->status=status;     t->next=NULL;     /* Insert at beginning */     if(head==NULL||head->studentID>=t->studentID){         t->next=head;         head=t;     }     /* Insert at Middle or End */     else{         Node *c=head;         while(c->next!=NULL && c->next->studentIDstudentID){             c=c->next;         }         t->next=c->next;         c->next=t;     }     cout<<"Record inserted successfully"<studentID==studentID){                 cout<<"Student ID: "<studentID<full_name<GPA<status<next;         }         if (p==NULL){             cout<<"No such record available"<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Complete this C++ code with the following requirements: 

Write a program that will allow a user to enter students into a database. The student information should include full name, student ID, GPA and status. The program should allow delete any student based on student ID. Program must use linked list. No vectors or arrays. C++.

 

# include<iostream>
using namespace std;
class Node{
    string full_name, status;
    int studentID;
    float GPA;
    Node* next;
};
Node* head= new Node();
bool check (int x){
    if(head==NULL){
        return false;
    }
    Node* t=new Node();
    t=head;
    while(t!=NULL){
        if(t->studentID==x){
            return true;
            t=t->next;
        }
    }
    return false;
}
void insert(int studentID, string full_name, string status, float GPA){
    if(check(student_id)){
        cout<<"Student already exists in the record"<<endl;
        return;
    }
    Node *t=new Node();
    t->studentID=studentID;
    t->full_name=full_name;
    t->GPA=GPA;
    t->status=status;
    t->next=NULL;
    /* Insert at beginning */
    if(head==NULL||head->studentID>=t->studentID){
        t->next=head;
        head=t;
    }
    /* Insert at Middle or End */
    else{
        Node *c=head;
        while(c->next!=NULL && c->next->studentID<t->studentID){
            c=c->next;
        }
        t->next=c->next;
        c->next=t;
    }
    cout<<"Record inserted successfully"<<endl;
}

void search(int studentID){
    if (!head){
        cout<<"No such record available"<<endl;
        return;
    }
    else{
        Node *p=head;
        while(p){
            if(p->studentID==studentID){
                cout<<"Student ID: "<<p->studentID<<endl;
                cout<<"Student Name: "<<p->full_name<<endl;
                cout<<"Student GPA: "<<p->GPA<<endl;
                cout<<"Student Status: "<<p->status<<endl;
                return;
            }
            p=p->next;
        }
        if (p==NULL){
            cout<<"No such record available"<<endl;
        }
    }
}

int main(void){
    Studen1 s1;
    Student s2;
    Student s3;
    s1.insert(100050,'John Murphy',3.58,'Pass');
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education