Here is the code for my program
The compiler is not showing errors but i want to see if the function i have written in case 4 will accept a title check against the array if it finds a match delete the record and the corresponding price
as the program is not loading once a number is inputted basically it need it to perform the delete function if a matching title is found
now it is the if loop and array declaration that i believe i have got wrong
Any Help on this would be greatly appreciated
Code:
// Book Price (16800960)
#include <iostream>
#include <string>
#include <iomanip>
const int MAXSIZE 300;
using namespace std;
void displayMenu ();
void listRecords(string allTitles[300], double allPrices[300], int totalRec);
string allTitles[MAXSIZE] = {
"Book 1",
"Book 2"
};
double allPrices[MAXSIZE] = {
78.5, 66.
};
int main ()
{
void displayMenu ();
cout << "MAIN MENU"<<"\n";cout<<endl;
cout << " 0. Exit " " 1. Enter Book " " 2. Find Book "<<"\n"; cout <<endl;
cout << " 3. List All " " 4. Delete Book" " 5. Update Book " << "\n";
cout <<endl;
string Title;
double Price;
int totalRec =2;
char menu;
cout << "Please Enter Menu Selection" ;
cin >> menu;
while (menu!=0);
switch (menu)
{
case '4':
string title;
cout << "Enter Title of the book record to delete ->";
getline(cin,title);
for(int i = 0; i < totalRec; i++)
{
if (title == allTitles[i])
{allTitles[i] = allTitles[i--];
allPrices[i] = allPrices[i--];
totalRec = (totalRec --);
cout << " Record Erased Successfully"; cout <<endl;
}}
The compiler is not showing errors but i want to see if the function i have written in case 4 will accept a title check against the array if it finds a match delete the record and the corresponding price
as the program is not loading once a number is inputted basically it need it to perform the delete function if a matching title is found
now it is the if loop and array declaration that i believe i have got wrong
Any Help on this would be greatly appreciated
Comment