Question: Can someone fix my code so my user interface is working? (The prototypes and function definition are on a separate file) Here is my code:
Can someone fix my code so my user interface is working? (The prototypes and function definition are on a separate file)
Here is my code:
#include
void getaddress (char [ ], int);
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; int ch; do { menu(); printf("Enter your choice: "); scanf("%d", &ch); printf(" "); // Accepts data for new customer if (ch == 1) { printf(" Enter account number: "); scanf("%d", &accNum); printf(" Enter name: "); scanf("%s", name); printf(" Enter mailing address: "); getaddress(); } //printing records in the database else if (ch == 2) { printAllrecords(); } // Accepts account number to search else if (ch == 3) { printf(" Enter account number to search: "); scanf("%d", &tempaccNum); findRecord(); } // Accepts account number to delete else if (ch == 4) { printf("Enter account number to delete: "); tempaccNum = 0; deleteRecord(); } // quit the program } while (ch != 5); return 0; }
Here are my Prototypes named record.h and database.h (They are stubs for now so they don't have anything)
record.h
struct record
{
int accountno;
char name[25];
char address[50];
struct record* next;
};
database.h
int addRecord (struct record **, int, char [ ],char [ ]); void printAllRecords(struct record *); int findRecord (struct record *, int); int deleteRecord(struct record **, int);
I don't need my function to work for its intended use since they are stubs what I need is someone to fix my code so that it can respond to the user when it executed the program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
