Question: Done in the C language. Instructor wants us to make a gradebook for him (because he cant grade him self. Instructions are below along with
Done in the C language. Instructor wants us to make a gradebook for him (because he cant grade him self. Instructions are below along with example code. Im working on it by myself too but this seems real spooky for an introductory class.


EXAMPLE CODE:
#include
#include
#include
typedef struct FullNameType {
char fname[51];
char lname[51];
struct FullNameType *next;
} FullNameType;
void swapPointers(char **p1, char **p2) {
char *tmp;
tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
void forceLowercase(char *s) {
for(int i=0; s[i]!=0; i++ ) {
if ( 'A'
s[i] = s[i] + 32;
}
}
}
int strcmp_ci(char *str1, char *str2) {
char tmp1[51], tmp2[51];
strcpy(tmp1,str1);
strcpy(tmp2,str2);
forceLowercase(tmp1);
forceLowercase(tmp2);
return strcmp(tmp1,tmp2);
}
int main(int argc, char **argv) {
int i,j,howMany;
int arraySize = 4;
FullNameType *nameListFirst, *nameListLast;
FullNameType *newFullName, *tmp, *before, *after;
FILE *inputNamesFile, *outputFile;
nameListFirst = NULL;
nameListLast = NULL;
inputNamesFile = fopen(argv[1],"r");
if ( inputNamesFile != NULL ) {
i = 0;
while ( ! feof(inputNamesFile) ) {
newFullName = malloc( sizeof(FullNameType) ); // allocate an "instance" of the structure
// should do bulletproofing to check whether malloc succeeded...
(*newFullName).next = NULL;
fscanf(inputNamesFile,"%50s %50s", (*newFullName).fname, (*newFullName).lname );
// inserting at the bottom of the list....
if (nameListLast != NULL) {
nameListLast->next = newFullName;
nameListLast = newFullName;
} else {
nameListFirst = newFullName;
nameListLast = newFullName;
}
i++;
}
howMany = i;
// From this point can do other things with the list... insert, delete, edit, save file, and so forth
} else {
printf("File %s not found!! ", argv[1]);
}
}
Each person's record will include first & last name ID number o an array of 5 "scores" (use double floating point numbers) o o The program should be able to read an input file and build a linked list of these structures o Read the input file until end of file o Example input file format 123456 Frodo Baggins 0 00 0 0 654321 Bilbo Baggins 0 00 0 0 555555 Samwise Gamgee 0000 0 888888 Iam Groot 000 0 0 The program presents the user with various options o (L)ist list the students, their scores, and averages show all info, make sure info is displayed neatly in columns " " o have column headers use lines o dashes, etc ...and the average of scores - o (S)ort the list... " sub-options by (Name by (i)D number o by the (A)erage score for that person o (A)dd an additional person to the list (filling in all info) o (D)elete a person Each person's record will include first & last name ID number o an array of 5 "scores" (use double floating point numbers) o o The program should be able to read an input file and build a linked list of these structures o Read the input file until end of file o Example input file format 123456 Frodo Baggins 0 00 0 0 654321 Bilbo Baggins 0 00 0 0 555555 Samwise Gamgee 0000 0 888888 Iam Groot 000 0 0 The program presents the user with various options o (L)ist list the students, their scores, and averages show all info, make sure info is displayed neatly in columns " " o have column headers use lines o dashes, etc ...and the average of scores - o (S)ort the list... " sub-options by (Name by (i)D number o by the (A)erage score for that person o (A)dd an additional person to the list (filling in all info) o (D)elete a person
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
