Question: Can someone fix the bolded part so it can handle errors also it would end the loop. (Please don't change the other part only the
Can someone fix the bolded part so it can handle errors also it would end the loop. (Please don't change the other part only the bold part thanks)
Here is the full code just fix the bold part
#include
#include"record.h"
#include"database.h"
void getaddress (char s[], int a){}
void menu()
{
printf(" Greetings, what do you want to do with the database? ");
printf("------------------------------------------------------------------------ ");
printf(" 1. add ");
printf(" 2. printall ");
printf(" 3. find ");
printf(" 4. delete ");
printf(" 5. quit ");
}
int main(int argc, char *argv[])
{
struct record * start = NULL;
int tempaccNum;
int accNum = 0;
char name[25];
char inputAddress[50];
int menus;
do {
menu();
printf("Enter your choice: ");
scanf("%d", &menus);
printf(" ");
/* Accepts data for new customer */
if (menus == 1) {
printf(" Enter account number: ");
scanf("%d", &accNum);
printf(" Enter name: ");
scanf("%s", name);
printf("Enter mailing address( press ';' to end input) ");
scanf("%[^;]s", inputAddress);
printf(" Address you Enter is %s", inputAddress);
getaddress(name, accNum);
} /* printing records in the database */
else if (menus == 2) {
printAllRecords(start);
} /* Accepts account number to search */
else if (menus == 3) { printf(" Enter account number to search: ");
scanf("%d", &tempaccNum);
findRecord(start, tempaccNum);
} /* Accepts account number to delete */
else if (menus == 4) {
printf("Enter account number to delete: ");
scanf("%d", &tempaccNum);
deleteRecord(&start, tempaccNum);
} /* quit the program */
} while (menus != 5);
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
