Help me fix all the error in this programme #include #include #include #include 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<bank_acc_name<bank_acc_num<bank_acc_bal<> searchNumber; cout<bank_acc_num,searchNumber) { cout<bank_acc_name<bank_acc_num<bank_acc_bal<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<bank_acc_name<bank_acc_num<bank_acc_bal<link; totalDetails++; } cout<<"\n Total number of user details: "<>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; }
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;
}
Step by step
Solved in 2 steps with 6 images