Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with debug mode. I'm really confused; my code is working I just need to somehow incorporate debug mode on my codes. Here

Please help me with debug mode. I'm really confused; my code is working I just need to somehow incorporate debug mode on my codes.

Here suppose to be the instruction:

  • Your program must use command-line arguments for debugging.

  • This program may be invoked by typing the executable name (./homework3) or with the option debug. (./homework3 debug). Anything else such as ./homework3 debug test or ./homework3 test should give an error message AND EXIT.

  • To check the given argument, use at least one function declared in string.h.

  • When the program runs in the debug option, it must print additional information on the screen.

    • The debug output must verify the following items

      • the name of the called function
      • The parameter names and values passed to the function (but you don't have to print variables of struct record * and struct record **)
    • Every non-main function definition, including the stubs, must have the debug output described above, when the debug option is invoked.

    • The output must be meaningful and distinguishable from the regular output.

      At least, you should add a blank line between the regular and debug outputs.

  • A global variable, debugmode, must be used to indicate whether the program is running in the debug mode or not.

Here is my code user_interface.c which needs debug mode

#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("%[^;]%*c", inputAddress);

getaddress(start->address, 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;

}

Here is record.c (this a stub so it doesn't have anything but it also needs debugmode) also use extern debugmode here as debugmode will be on the user_interface where main function is.

#include

struct record

int addRecord (struct record **, int, char [ ],char [ ]) {

return 0;

}

void printAllRecords(struct record *) {

}

int findRecord (struct record *, int) {

return 0;

}

int deleteRecord(struct record **, int)

{

return 0;

}

Please try your best to help me thanks!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago