subject

Please help filling in the functions displaycourses(), enternew(), displaydb() #include
#include
#include
#include

#define SIZE 30
#define fieldLength 200

#define diskFile "diskFile. dat"
#define courseFile "course. txt"

struct db_type
{
char name[fieldLength];
int age;
char course1[fieldLength];
char course2[fieldLength];
char status[fieldLength];
};

struct courseInfo
{
char code [20]; // e. g., EECS2030
char title [fieldLength];
char date [20];
char time_start [20];
char time_end [20];
char location [20];
};

struct courseInfo courseArr[SIZE]; // global variable array of struc

char prompt_menu(void);
void init_list(struct db_type * pArr[]);
void clearDB(struct db_type * pArr[]);
void init_courseArr(void);

void writeDisk(struct db_type * pArr[]);
void emptyDisk(void);
void loadDisk(struct db_type * pArr[]);

int main(int argc, char *argv[])
{

struct db_type * db_pArr[SIZE]; // main db storage

init_list(db_pArr); // set to NULL

init_courseArr(); // load course from diskfile

char choice;
for(; ;){
choice = prompt_menu();
switch (choice)
{
case 'n': enterNew(db_pArr); break;
case 'd': displayDB(db_pArr); break;
case 'w': writeDisk(db_pArr); break;
case 'l': loadDisk(db_pArr); break;
case 's': sort(db_pArr); break;

case 'c': clearDB(db_pArr); break;
case 'e': emptyDisk();break;

case 'v': displayCourses();break;
case 'p': swap(db_pArr); break;
case 'r': removeRecord(db_pArr);break;

case 'q': exit(1); // terminate the whole program
}

}
return 0;
}

void init_list(struct db_type * pArr[]){
int t;
for (t=0; t {
pArr[t]= NULL;
}
}

void clearDB(struct db_type * pArr[]){
char c3[3];
printf("are you sure to clear db? (y) or (n)? ");

fgets(c3,3,stdin);

if(! strcmp(c3, "y\n"))
init_list(pArr);
}

char prompt_menu(void){
char s[80];
while(1){
printf("\n\n");
printf("| %-20s","(N)ew record");
printf("%-20s","(R)emove record");
printf("Swa(p) records\t|\n");
printf("| %-20s","(S)ort database");
printf("%-20s","(C)lear database");
printf("(D)isplay db\t|\n");

printf("| %-20s","(L)oad disk");
printf("%-20s","(W)rite disk");
printf("(E)mpty disk\t|\n");

printf("| %-20s", "(V)iew courses");//|\tSwa(p) record\t(Q)uit\t\t\t\t|\n");
printf("%-20s","(Q)uit");
printf("*Case Insensitive*\t|\n");
printf("\n");
printf("choose one: ");

fgets(s,50, stdin); // \n added

if (strlen(s) == 2 && strchr("edlsuqrcwnvpr", tolower(*s)))
return tolower(*s); // s[0], return the first character of s
//else
printf("not a valid input!\n");

}
}

/* display all or specified course */
void displayCourses(void){
; // the provide PE2.out uses "%s\t%-40s%-5s %s-%s %s\n" as formatting string for printing each course info

}

/* input items into the list */
void enterNew(struct db_type * pArr[SIZE]){
;

}

/* display records */
void displayDB(struct db_type * pArr[]){
;

}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:40
How do i get the most points, without any effort?
Answers: 2
question
Computers and Technology, 22.06.2019 15:50
The file sales data.xlsx contains monthly sales amounts for 40 sales regions. write a sub that uses a for loop to color the interior of every other row (rows 3, 5, etc.) gray. color only the data area, columns a to m. (check the file colors in excel.xlsm to find a nice color of gray.)
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
You know the right answer?
Please help filling in the functions displaycourses(), enternew(), displaydb() #include
#inc...
Questions
question
History, 06.10.2020 15:01
question
History, 06.10.2020 15:01
question
Spanish, 06.10.2020 15:01
question
History, 06.10.2020 15:01
question
Mathematics, 06.10.2020 15:01
question
Spanish, 06.10.2020 15:01
question
Mathematics, 06.10.2020 15:01
question
Chemistry, 06.10.2020 15:01
question
History, 06.10.2020 15:01
question
Physics, 06.10.2020 15:01
Questions on the website: 13722367