For each of the functions I need to test them by calling them in main and printing the printf statements. I'm having some trouble and was wondering if anyone can help me.
Thanks!
Thanks!
Code:
#include <stdio.h>
#include "record.h"
int debugmode = 0;
void getfield(struct record*, char [], char [], char []);
int addRecord(struct record**, char[], char[], int, char[]);
int printRecord(struct record*, char[]);
int modifyRecord(struct record*, char[], char[], char[]);
void printAllRecords(struct record*);
int deleteRecord(struct record**, char[]);
int main (int argc, const char * argv[]) {
//record *start NULL;
int input;
int option;
char name[25];
printf("To enter debug mode enter 1; ");
printf("for regular mode enter 0:\n");
scanf("%d", &input);
if (input == 0)
{
printf("You have entered regular mode.\n");
}
else if(input == 1)
{
printf("You have entered debug mode.\n");
}
else
{
printf("ERROR: You must enter either 0 or 1 !\n");
return 0;
}
printf("Please select from the following options :\n");
do {
printf("\n 1:\t Add a new record in the database\n 2:\t Modify a record in the database using the name as a key\n 3: \t Print information about a record in the database using the name as a key\n 4: \t Print all information in the database \n 5: \t Delete an existing record from the database using the name as a key\n 6: \t Quit the program\n");
scanf("%d", &option);
if (input == 1 && option == 1) {
printf("Please enter the a name, address, DOB, & telepone number:\n");
getfield(struct record*, name[], telno[], address[]);
}
if (input == 1 && option == 2)
{
printf("Please enter the a name of the record you wish to modify:\n");
}
if (input == 1 && option == 3)
{
printf("Please enter the a name of the record you wish to print:\n");
}
if (input == 1 && option == 4)
{
printf("Here are all the records in the database:\n");
}
if (input == 1 && option == 5)
{
printf("Please enter the a name of the record you wish to delete:\n");
}
} while (input == 1 && option != 6 || input == 0 && option != 6);
printf("\nThank you, Goodbye!\n");
return 0;
}
Code:
struct record
{
char name[25];
char address [80];
int yearofbirth;
char telno[15];
struct record* next;
};
Code:
int addRecord(struct record**, char[], char[], int, char[]){
printf("You have entered the addRecord function");
}
int printRecord(struct record*, char[]){
printf("You have entered the printRecord function");
}
int modifyRecord(struct record*, char[], char[], char[]){
printf("You have entered the modifyRecord function");
}
void printAllRecords(struct record*){
printf("You have entered the printAllRecords function");
}
int deleteRecord(struct record**, char[]){
printf("You have entered the deleteRecord function");
}
Comment