Article Index

This was a project from high school done with a friend that implemented a doubly linked list and used this list to manage a database of school records.

Compile with gcc *.c

This is the entry point of the program. At launch, it allocates memory for the database and prompts the user for an action.

#include "project.h"
COURSE array[255];                                         //Declare global Variables
COURSE* FIRST;
COURSE* LAST;
char filename[255];

void main(void)
{
	char choice;                                             //Declare Variables
	int i = 0;
	BOOLEAN quit = FALSE;

	FIRST = NULL;                                            //Initialize variables                         
	LAST = NULL;
	for(i = 0; i < 256; i++)
		InitializeRec(&array[i]);
	filename[0] = '\0';

	i = 0;
	
	do                                                       //menu open until quit = TRUE
	{
	choice = DisplayMainMenu();                              //Display Main Menu and Get Main Menu Choice
	
	switch(choice)                                           //Menu swithc
		{
			case 'o': OpenData();
				break;
			case 'a': AddRec();
				break;
			case 's': SearchData();
				break;
			case 'b': BrowseData();
				break;
			case 'd': printf("\nDelete Record\n");
				break;
			case 'c': CloseData();
				break;
			case 'q': quit = QuitProgram();
				break;
			default: printf("\nError\nPlease enter a valid response.\n");
				break;
		}

	}while(!quit);

	return;                                                    //Exit the program.
}
Log in to comment