Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
100%

Help me fix all the error in this programme

#include <iostream>
#include <iomanip>
#include <ctype.h>
#include <string.h>

using namespace std;

struct nodeBankAccount
  {
    char bank_acc_name[30];
    string bank_acc_num;
    double bank_acc_bal;
      
    nodeBankAccount*link;
};

nodeBankAccount *head, *rear;
nodeBankAccount *current;
nodeBankAccount *newNode;
nodeBankAccount *deleteBank;
nodeBankAccount *previous;
nodeBankAccount *found;

void searchBankAccount()
{
    char searchName[30];
    int searchNumber = 0;
    int searchOption;
    char answer;
    int searchNumber_No = 0;
    
    found = NULL;
    current = head;
    
    if(current == NULL)
    {
        cout<<"\n\n List is empty!!!\n";
        cout<< "Cannot perfom search operation \n\n";
        
    }else{
        do
        {
            cout << "\n\tSearch record\n";
            cout << "\t\tSearch Menu\n";
            cout<<"\nEnter 1 to search by Bank Account Name\n: ";
            cout<<"\nEnter 2 to search by Bank Account Number \n: ";
            cout<<"\nEnter 3 to back to Main Menu\n: ";
            
            cout << "Enter your option: ";
            cin >> searchOption;
            
            switch (searchOption)
            {
                case 1: cout<<"\nEnter Bank Account Name to be searched: ";
                        cin>>ws;
                        cin.getline(searchName,30);
                while (current != NULL)
                {
                    if(strcmp(current->bank_acc_name,searchName)==0 )
                    {
                        found = current;
                        break;
                    }else{
                        current = current->link;
                    }
                }
                    if(found == NULL)
                    {
                        cout<<"\n\nRecord does not exist!!!\n\n";
                        
                    }else{
                        cout<<endl<<left<<setw(30)<<"Bank Account Name"<<setw(30)<<"Bank Account Number"<<setw(10)<<"Bank Account Balance"<<endl;
                        cout<<left<<setw(30)<<current->bank_acc_name<<setw(30)<<current->bank_acc_num<<current->bank_acc_bal<<endl;
                    }
                        if (searchName == 0)
                        {
                            cout<<"\n\nRecord does not exist!!!\n\n";
                        }else{
                            cout << "\nTotal number of records found: " << searchName << endl;
                        }
                        break;
                case 2: cout << "\n\nEnter Bank Account Number to be searched: ";
                        cin >> searchNumber;
                        
                        cout<<endl<<left<<setw(30)<<"Bank Account Name"<<setw(30)<<"Bank Account Number"<<setw(10)<<"Bank Account Balance"<<endl;
                        
                while (current != NULL)
                {
                    if(current->bank_acc_num,searchNumber)
                    {
                        cout<<left<<setw(30)<<current->bank_acc_name<<setw(30)<<current->bank_acc_num<<current->bank_acc_bal<<endl;
                        searchNumber_No++;
                    }
                    current = current->link;
                    }
                    if (searchNumber_No == 0)
                    {
                        cout << "\n\nRecord does not exist!!\n\n";
                    }else{
                    cout << "\nTotal Number of Records found: " << searchNumber_No << endl;
                    }
                    break;
                case 3: cout << "\n\nBack to Main Menu" << endl;
                        cin >> answer;
            }
        }
    }   

void viewBankAccount()
{
    int no=1;
    int totalDetails = 0;
 
    cout<<endl<<left<<setw(5)<<"No."<<setw(30)<<"Bank Account Name"<<setw(30)<<"Bank Account Number"<<setw(10)<<"Bank Account Balance"<<endl;
    
    current = head;
    while(current != NULL)
    {
        cout<<left<<setw(5)<<no<<setw(30)<<current->bank_acc_name<<setw(30)<<current->bank_acc_num<<current->bank_acc_bal<<endl;
        no++;
        current = current->link;
        totalDetails++;
    }
    
    cout<<"\n Total number of user details: "<<totalDetails<<endl;
}

int main()
{

    int menuOption;
    char answer;
    
    head = NULL;
    
    do
    {
        cout<<"\n\n\tBank Account Details\n";
        
        cout<<"\t\tMain Menu\n";
        cout<<"1 - Add Bank Account details\n";
        cout<<"2 - Search Bank Account details\n";
        cout<<"3 - Delete bank account details\n";
        cout<<"4 - View details\n";
        cout<<"5 - Exit\n";

        cout<<"Enter your option [1, 2, 3, 4 or 5]: ";
        cin>>menuOption;
        
        switch(menuOption)
        {

            case 2: searchBankAccount();
                    break;

            case 4: viewBankAccount();
                    break;
                    
            case 5: cout<<"\n\n Program End\n\n";
                    break;
            
            default: cout<<"Wrong option. Please reenter your option\n";
            
        }
    }while(menuOption != 5);
    
    return 0;

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education