Computers and Technology

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[]){
;

}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:30, genyjoannerubiera
What does a cascading style sheet resolve a conflict over rules for an element? a. the rule affecting the most content wins b. the rule affecting the most content loses c. the rule with the most specific selector loses d. the rule with the most specific selector wins
Answers: 2
image
Computers and Technology, 22.06.2019 22:30, reinasuarez964
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
image
Computers and Technology, 22.06.2019 23:50, Emptypockets451
You need to design a circuit that implements the functions in the following table: s0 s1 function0 0 a + 10 1 a – b1 0 a + b1 1 a – 1s0 and s1 are 1-bit control inputs to select the function of the circuit. inputs a and b are 4-bitnumbers in 2s complement form. the output is also a 4-bit number in 2s complement form. you are allowed to use only one ttl 7483 4-bit adder to implement all the functions. but anynumber of other components (except the adder) can be used. hint: design a combinational logic circuit to modify the input b and the “carry input” of theadder depending on the control inputs s0 and s1.important: lab grade will depend on the working of the circuit & will be checked of by your labinstructor.1. is the output valid for the following input combinations: a. s0 = 0, s1 = 0, a = 7, b = 3? b. s0 = 0, s1 = 1, a = 7, b = 3? c. s0 = 1, s1 = 0, a = -4, b = -5? d. s0 = 1, s1 = 1, a = -8, b = 6? 2. what is the range of inputs (for both a and b) that will produce the valid output for all the functions?
Answers: 3
image
Computers and Technology, 23.06.2019 18:30, aalyssag606
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
Do you know the correct answer?
Please help filling in the functions displaycourses(), enternew(), displaydb() #include
#inc...

Questions in other subjects:

Konu
Business, 01.02.2021 01:00
Konu
Business, 01.02.2021 01:00