Exemplo n.º 1
0
//display_all function takes the root pointer as and argument displays all nodes and 
//returns and int indicating success.
int table::display_all(node * & root)
{
    if(!root)
        return 1;
    display_all(root->left);
    root->the_job->display();
    display_all(root->right);
    return 1;
}
Exemplo n.º 2
0
int		display_msg(t_vm *vm)
{
  SDL_Surface	*txt;
  SDL_Rect	p;
  TTF_Font	*police;
  static SDL_Color	color;

  pthread_cancel(vm->thread);
  display_all(vm, 0);
  if ((police = TTF_OpenFont("./clips/font/0.ttf", 37)) == NULL)
    return (EXIT_FAILURE);
  p.x = 635;
  p.y = 353;
  vm->image[GAME][MSG_KENNY].pos.x = 600;
  vm->image[GAME][MSG_KENNY].pos.y = 330;
  SDL_BlitSurface(vm->image[GAME][MSG_KENNY].img, NULL, vm->sc,
		  &vm->image[GAME][MSG_KENNY].pos);
  if (vm->winner != NULL && vm->no_graph != EXIT_FAILURE)
    txt = TTF_RenderText_Blended(police,
				 my_str_concat(my_str_concat("Le joueur ", \
				 vm->winner->prog_name), " a gagne"), color);
  SDL_BlitSurface(txt, NULL, vm->sc, &p);
  SDL_Flip(vm->sc);
  display_loop_msg_end(vm);
  return (0);
}
Exemplo n.º 3
0
int main(void)
{
	int option;
	point *start=NULL;

	do
	{
		//Display user menu
		printf("0 - quit\n");
		printf("1 - add\n");
		printf("2 - remove\n");
		printf("3 - display all\n");
		printf("Enter option: ");
		fflush(stdout);

		scanf("%2d", &option);

		//Process option
		switch (option)
		{
			case 1: start = add_point(start);
				break;
			case 2: start = remove_point(start);
				break;
			case 3: display_all(start);
				break;
		}
	}while (option != 0);


	return 0;
}
Exemplo n.º 4
0
void entry_menu()
{
	char ch;
	int num;
     cleardevice();
     start();
 
 settextstyle(TRIPLEX_FONT,HORIZ_DIR,6);
	setcolor(LIGHTBLUE);
	outtextxy(25,40," ENTRY MENU ");
	setcolor(YELLOW);
	settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);

	outtextxy(60,150,"1)CREATE STUDENT RECORD");
	outtextxy(60,210,"2)DISPLAY ALL STUDENTS RECORDS");
	outtextxy(60,270,"3)SEARCH STUDENT RECORD");
	outtextxy(60,330,"4)MODIFY STUDENT RECORD");
	outtextxy(60,390,"5)GO BACK TO THE MAIN MENU");
	
	switch(getch())
	{
	case '1':	write_student(); break;
	case '2':	display_all(); break;
	case '3':	cout<<"\n\n\tPlease Enter The roll number "; cin>>num;
			    display_sp(num); break;
	case '4':	cout<<"\n\n\tPlease Enter The roll number "; cin>>num;
			modify_student(num);break;
	case '5':	cout<<"\n\n\tPlease Enter The roll number "; cin>>num;
			delete_student(num);break;
	case '6':	break;
	default:	cout<<"\a"; entry_menu();
	}
}
Exemplo n.º 5
0
int main()
{
  island* start;
  start = get_islands();   
  display_all(start);
  release_all(start);
  return 0;
}
Exemplo n.º 6
0
void simulate_MainWindow::on_btn_next_clicked()
{
    PC=nextPC;
    coutString="";
    display_all();
    if((PC/4)>=binList.length())
    {
        coutString="\n\n-----------------------\n\n";
        coutString+="The program is end.";
        coutString+="\n\n-----------------------\n\n";
        ui->consoleTextEdit->setText(coutString);
        return;
    }
    simulate();
    if(nextPC==PC)
        nextPC=PC+4;
    display_all();
}
Exemplo n.º 7
0
void simulate_MainWindow::on_btn_reset_clicked()
{
    PC=0;
    ui->startLineEdit->setText("0");
    for(int i=0;i<32;i++)
        r[i]=0;
    coutString="";
    display_all();
}
Exemplo n.º 8
0
int main(void)
{
	int option, i = 0;
	FILE *fp1;
	point *start =NULL;									// root node

	do													// do while loop
	{
		//Display user menu
		printf("\n\n0 - quit\n");
		printf("1 - ADD A Record\n");
		printf("2 - Remove A Record\n");
		printf("3 - Display All Records\n");
		printf("4 - Save\n");
		printf("5 - Load Saved Data\n");
		printf("Enter Option: ");
		fflush(stdout);

		scanf("%2d", &option);
		getchar();
		
		//Process option
		switch (option)									// switch statement to decide next action
		{
			case 1: start = add_point(start);
				break;
			case 2:	display_all(start); start = remove_point(start);
				break;
			case 3: display_all(start);
				break;
			case 4: write_to_disk(fp1, start);
				break;
			case 5: start = NULL; start = read_from_disk(fp1,start); printf("\nSAVED DATA:\n");
				break;
		}
	}while (option != 0);

	return 0;
}
Exemplo n.º 9
0
int	display_lines(char *lines)
{
  char	*spaces;
  int	nb;

  if ((spaces = my_malloc(4)) == 'NULL')
    return (0);
  spaces[0] = 3;
  spaces[1] = 2;
  spaces[2] = 1;
  spaces[3] = 0;
  display_all(spaces, lines);
}
Exemplo n.º 10
0
int main(void){
	pos* table = init_table();
	build_positions(table, 10);
	move_onto(table, 9,1);
	move_over(table, 8,1);
	move_over(table, 7,1);
	move_over(table, 6,1);
	pile_over(table, 8,6);
	pile_over(table, 8,5);
	move_over(table, 2,1);
	move_over(table, 4,9);
	display_all(table);
	return 0;
}
Exemplo n.º 11
0
Arquivo: ex.cpp Projeto: lostjared/mxl
int main(int argc, char **argv)
{


	std::cout << "Welcome to the libmxl example enter filename of db to load: ";
	std::string filename;
	getline(std::cin, filename);
	mxlParser p;
	p.parseMXL_file(filename);

	
	char c = 'y';
	while(c == 'y')
	{
		std::cout << "Options are :\n1 dispaly all numbers\n2 search\n3 enter number\n4 exit saving changes\n5 exit discarding changes\n";
		int op;
		std::cout << "enter option: ";
		std::string op_s;
		getline(std::cin, op_s);
		op = atoi(op_s.c_str());

			switch(op) 
			{
			case 1:
				display_all(p);
			break;

			case 2:
				display_find(p);
			break;

			case 3:
				print_options(p);
			break;
			case 4:
				exit_save(p);
				exit(EXIT_SUCCESS);
			break;
			case 5:
				exit(EXIT_SUCCESS);
			break;
			}


	}
	
	return EXIT_SUCCESS;
}
Exemplo n.º 12
0
static void		the_following(char ***av, char *option, int mode)
{
	if (mode == 1)
		skip_option(av);
	ascii_sort((*av));
	check_error((*av));
	if (mode == 1)
	{
		if (IS_T && !(IS_F))
			mod_time_sort((*av) + arg((*av), 0));
		else if (!(IS_F) && !(IS_T))
			ascii_sort((*av));
		(IS_R_2 && !(IS_F)) ? rev_sort((*av) + arg((*av), 0)) : 0;
	}
	display_all(*av, option);
}
Exemplo n.º 13
0
static void
display_settings(enum output_type output_type, struct termios *mode,
				 int fd, const char *device_name)
{
	switch (output_type) {
	case changed:
		display_changed(mode);
		break;

	case all:
		display_all(mode, fd, device_name);
		break;

	case recoverable:
		display_recoverable(mode);
		break;
	}
}
Exemplo n.º 14
0
void	main_loop(t_dlist *list, t_all *all)
{
	int			skip;
	Uint32 		ticks;
	SDL_Event	event;

	printf("Go : \n");
	skip = FALSE;
	all->pos.x = 0;
	all->pos.y = 0;
	while (skip == FALSE)
	{
		skip = fps_system(all, list);
		while (SDL_PollEvent(&event))
			skip = key_hook(event);
		display_all(all, list);
		SDL_Flip(all->win);
	}
}
Exemplo n.º 15
0
void		display_cartman_leave(t_vm *vm)
{
  FMOD_CHANNEL	*ch;

  FMOD_Channel_Stop(vm->sound[AMB][1].ch);
  FMOD_System_PlaySound(vm->sound[EVENT][CARTMAN_LEAVE].sys, FMOD_CHANNEL_FREE,
			vm->sound[EVENT][CARTMAN_LEAVE].sound, 0, &ch);
  vm->image[GAME][CARTMAN_FRONT].pos.x = 535;
  vm->image[GAME][CARTMAN_FRONT].pos.y = 750;
  vm->nb_champ = 0;
  while (vm->image[GAME][CARTMAN_FRONT].pos.x < 1250)
    {
      display_all(vm, 0);
      SDL_BlitSurface(vm->image[GAME][CARTMAN_FRONT].img, NULL, vm->sc,
		      &vm->image[GAME][CARTMAN_FRONT].pos);
      vm->image[GAME][CARTMAN_FRONT].pos.x =
	vm->image[GAME][CARTMAN_FRONT].pos.x + 4;
      SDL_Flip(vm->sc);
    }
}
Exemplo n.º 16
0
void		display_kenny_angel(t_vm *vm)
{
  FMOD_CHANNEL	*ch;

  FMOD_Channel_Stop(vm->sound[AMB][1].ch);
  FMOD_System_PlaySound(vm->sound[EVENT][KILL_KENNY].sys, FMOD_CHANNEL_FREE,
			vm->sound[EVENT][KILL_KENNY].sound, 0, &ch);
  vm->image[GAME][KENNY_ANGEL].pos.x = 570;
  vm->image[GAME][KENNY_ANGEL].pos.y = 400;
  vm->nb_champ = 0;
  while (vm->image[GAME][KENNY_ANGEL].pos.y > 220)
    {
      display_all(vm, 0);
      SDL_BlitSurface(vm->image[GAME][KENNY_ANGEL].img, NULL, vm->sc,
		      &vm->image[GAME][KENNY_ANGEL].pos);
      vm->image[GAME][KENNY_ANGEL].pos.y =
	vm->image[GAME][KENNY_ANGEL].pos.y - 2;
      SDL_Flip(vm->sc);
    }
}
Exemplo n.º 17
0
int main()
{
	struct student s;
	struct student s1[10];
	int n,d,ch2,ch1;
	printf("enter the number of records  to be entered");
	scanf("%d",&n);
	printf("choose the way to operate:\n 1.with pointer\n 2. without pointer");
	scanf("%d",&ch1);
	switch(ch1)
	{
	case 1:
		{
			input_p(&s,n);

			do
				{
				printf("choose the operation to perform:\n 1.display all\n 2.display particular\n 3.delete\n 4.insert\n 5.bubble sort\n 6.selection sort\n 7.binary seach");
				scanf("%d",&ch2);
				switch(ch2)
				{
					case 1:
						display_all_p(&s,n);
					break;
					case 2:
						printf("enter the record to be displayed");
						scanf("%d",&d);
						display_part_p(&s,d);
					break;
					case 3:
						printf("\n enter the record to be deleted");
						scanf("%d",&d);
						del_p(&s,d,n);
					break;
					case 4:
						printf("\n enter the position at which record is to be inserted");
						scanf("%d",&d);
						ins_p(&s,d,n);
					break;
					case 5:
						printf("you chose to sort the records by their roll no using bubble sort");
						bubblesort(&s,n);

						break;
					case 6:
						printf("you chose to sort the records by their roll no using selection sort");
						selection_sort(&s,n);

						break;
					case 7:
						printf("you chose to search a record using binary search by their roll no");

						bin_search(&s,n);
						break;
					default:
						break;
				}
			}while(ch2!=8);

		}
		break;
	case 2:
		{
			input(s1,n);
			do
			{
				printf("choose the operation to perform:\n 1.display all\n 2.display particular\n 3.delete\n 4.insert\n 5. exit");
				scanf("%d",&ch2);
				switch(ch2)
				{
					case 1:
						display_all(s1,n);
					break;
					case 2:
						printf("enter the record to be displayed");
						scanf("%d",&d);
						display_part(s1,d);

					break;
					case 3:
						printf("\n enter the record to be deleted");
						scanf("%d",&d);
						del(s1,d,n);
					break;
					case 4:
						printf("\n enter the position at which record is to be inserted");
						scanf("%d",&d);
						ins(s1,d,n);
					break;
					default:
						printf("please enter a valid input");
						break;
				}
			}while(ch2!=5);
		}
		break;
	default:
		break;

	}
	getchar();
	return 0;
}
Exemplo n.º 18
0
void simulate_MainWindow::simulate()
{
    currInstr=instrList[PC/4];
    currBin=binList[PC/4];

    vector<string> result;
    string temp=currInstr.toStdString();
    string_split(temp,result);

    coutString="";
    RD=RS=RT=immediate=address=0;
    v0=v1=v2=v3="None";
    v0=result[0];
    v1=result[1];
    printf("v0=%s\nv1=%s\n",v0.c_str(),v1.c_str());
    if(v0=="jr"||v0=="j"||v0=="jal")  // 2 parametes
    {
        if(v0=="jr")
        {
            jr();
        }
        else if(v0=="j")
            j();
        else if(v0=="jal")
            jal();
    }
    else if(v0=="lui")    // 3 parameters
    {
        v2=result[2];
        lui();
    }
    else                 // 4 parameters
    {
        v2=result[2];
        v3=result[3];
        if(v0=="add")
            add();
        else if(v0=="addu")
            addu();
        else if(v0=="sub")
            sub();
        else if(v0=="subu")
            subu();
        else if(v0=="and")
            and_funct();
        else if(v0=="or")
            or_funct();
        else if(v0=="xor")
            xor_funct();
        else if(v0=="nor")
            nor();
        else if(v0=="slt")
            slt();
        else if(v0=="sltu")
            sltu();
        else if(v0=="sll")
            sll();
        else if(v0=="srl")
            srl();
        else if(v0=="sllv")
            sllv();
        else if(v0=="srlv")
            srlv();
        else if(v0=="srav")
            srav();
        else if(v0=="addi")
            addi();
        else if(v0=="addiu")
            addiu();
        else if(v0=="andi")
            andi();
        else if(v0=="ori")
            ori();
        else if(v0=="xori")
            xori();
        else if(v0=="sw")
            sw();
        else if(v0=="lw")
            lw();
        else if(v0=="beq")
            beq();
        else if(v0=="bne")
            bne();
        else if(v0=="slti")
            slti();
        else if(v0=="sltiu")
            sltiu();
    }
    display_all();
}
Exemplo n.º 19
0
//display_all wrapper, takes no arguments, calls the display all function passing it the
//root pointer and returns and int indiscting success
int table::display_all_wrap(void)
{
    return display_all(root);
}
Exemplo n.º 20
0
int main(int argc, char *argv[])
{

    // Init Display/SDM
    int continuer = 1; /* la variable coninuer sera égale à 0 si on veux quitter le programme */
    display *disp;

    SDL_Event event;
    int repeat;
  /*  Uint8 *keystate;*/

    disp = initialize_display_module();
    initialize_SDL();
    repeat = SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 3);

    //Init du main_char
    character* main_char;
    main_char = init_mainChar();

    coordinate* speed;
    state cState;
    int* jumpSpeed;

    //Init Plateforme
    plateform* floor;
    floor = init_plateform();

    set_pHitbox(floor, 640, 200);
    set_pPosition(floor, 0, 640-200);

    set_dCharacter_sprite(disp, "sprite/main_character.bmp");
    set_dPlatform_sprite(disp, "sprite/floor.bmp");

    set_dPlatform_position(disp, get_pPosition(floor));

    SDL_BlitSurface(disp->platform->image, NULL, disp->screen, disp->platform->position);


    speed = get_cSpeed(main_char);
    cState = get_cState(main_char);

    while(continuer)
    {
        SDL_PollEvent(&event);
        switch(event.type)
        {
            case SDL_QUIT:
                continuer = 0;
                break;

            case SDL_KEYDOWN:
                switch(event.key.keysym.sym)
                {
                    case SDLK_ESCAPE:
                        continuer = 0;
                        break;

                     case SDLK_LEFT:
                        if(cState == jump)
                            set_cSpeed(main_char, speed->x-1, speed->y);
                        else
                            set_cSpeed(main_char, -1, speed->y);
                        break;

                    case SDLK_RIGHT:
                        if(cState == jump)
                            set_cSpeed(main_char, speed->x+1, speed->y);
                        else
                            set_cSpeed(main_char, 1, speed->y);
                        break;

                    case SDLK_SPACE:
                        if(cState != jump)
                        {
                            set_cState(main_char, jump);
                            *jumpSpeed = 10;
                        }
                        break;
                }
        }

        if(get_cState(main_char) == jump)
            cJump(main_char, jumpSpeed);

        move_char(main_char);

        set_dCharacter_position(disp, get_cPosition(main_char));

        display_all(disp);
    }

    free_display_module(disp);
    free_SDL();

    free_mainChar(main_char);
    free_plateform(floor);

    return 0;
}
Exemplo n.º 21
0
int main(){
	FILE *fp;
	char source[20],destination[20],filename[20],filename2[20],deleted[20];
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int n,t_date,t_month,t_year,date,month,year,t,bus_no,seat_no;
	do{
		start=readbus(start);
		printf("*---------------------------------------------------------------------*\n");
		printf("*       1.Information about all buses                                 *\n");
		printf("*       2.Available buses between one station to another station      *\n");					//following operations can be done
		printf("*       3.Reserve ticket for a particular bus                         *\n");										//by using this program						
		printf("*       4.Cancel ticket                                               *\n");
		printf("*       5.exit                                                        *\n");
		printf("*---------------------------------------------------------------------*\n");
		printf("Enter your choice\t-->");
		fflush(stdin);
		scanf("%d",&n);
		n=checkinteger(n);
		t=n;
		if(n==3)
		n=2;
			switch(n){																	//operations have done by using switch case
				case 1:
					display_all(start);												 
					break;
				case 2:	
					fflush(stdin);																		
					fp=fopen("todaydate.txt","r");									//read the today date by using file "todaydate.txt"
					if(fp==NULL)
						printf("can't open file\n");
					else
					while(fscanf(fp,"%d%d%d",&t_date,&t_month,&t_year)!=EOF);		//scan date,month,year by user to check availability
					printf("Enter your source station\t-->");
					scanf("%s",source);
					printf("Enter your destination\t-->");									//scan source,desetination stations by user
					scanf("%s",destination);
					int i=1;
					while(i){
						fflush(stdin);
						printf("Enter your date of journey\t-->");
						scanf("%d",&date);
						date=checkinteger(date);
						printf("Enter your month of journey\t-->");
						fflush(stdin);
						scanf("%d",&month);
						month=checkinteger(month);
						printf("Enter your year of journey\t-->");
						fflush(stdin);
						scanf("%d",&year);
						year=checkinteger(year);
						if(year%4==0)
						a[1]=29;
						if(month<=12&&month>0&&date<=a[month-1]){
							if(year==t_year){
								if(month==t_month){
									if(date>=t_date)
									i=0;
									else
									i=1;
								}
								else if(month>t_month)									//check the date if it is right or wrong
								i=0;
								else
								i=1;
							}
							else if(year>t_year)
							i=0;
							else
							i=1;
						}
					}
					assign(date,month,year);
					checkbus(start,source,destination);
					if(t==2)
					break;
				case 3:
					fflush(stdin);
					printf("Enter busno to reserve\t-->");
					fflush(stdin);
					scanf("%d",&bus_no);
					bus_no=checkinteger(bus_no);
					t=reserve(bus_no);
					if(t!=0){
					fp=fopen("filename.txt","w");
					fprintf(fp,"%d%d%d%d",date,month,year,bus_no);						//file created by "datemonthyearbusno.txt"
					fclose(fp);
					fp=fopen("filename.txt","r");
					fscanf(fp,"%s",filename2);
					fclose(fp);
					strcat(filename2,".txt");
					fp=fopen(filename2,"a");
					if(fp==NULL)
					printf("can't open file\n");
					fclose(fp);
					seatsallocation(bus_no,filename2);
					}
					break;
				case 4:
						printf("Enter your date of journey\t-->");
						fflush(stdin);
						scanf("%d",&date);
						date=checkinteger(date);
						printf("Enter your month of journey\t-->");
						fflush(stdin);
						scanf("%d",&month);
						month=checkinteger(month);
						printf("Enter your year of journey\t-->");
						fflush(stdin);
						scanf("%d",&year);
						year=checkinteger(year);
						printf("enter bus no\t-->");
						fflush(stdin);
						scanf("%d",&bus_no);
						printf("enter seat_no\t-->");
						scanf("%d",&seat_no);
						seat_no=checkinteger(seat_no);
						fp=fopen("filename.txt","w");
						fprintf(fp,"%d%d%d%d",date,month,year,bus_no);			//ticket is cancell on "datemonthyearbusno.txt"
						fclose(fp);
						fp=fopen("filename.txt","r");
						fscanf(fp,"%s",deleted);
						fclose(fp);;
						strcat(deleted,".txt");
						cancelticket(deleted,seat_no);
						printf("\n:::Ticket cancelled on your date:::\n\n");
					break;		
			}
			ptr=start;
			while(ptr!=NULL){
				ptr=start;
				start=start->next;											//free all node in the linkedlist which stores details of "busdetails.txt"
				free(ptr);
				ptr=ptr->next;
			}	
	}while(n!=5);
	return 0;
}
Exemplo n.º 22
0
void animation(Animation id, Coords pos, Coords dir)
{
	if (!run_animations)
		return;
	static Coords targets[32];
	i64 target_count = 0;

	display_all();

	switch (id) {
	case EXPLOSION:
		for (Coords d: square_shape)
			targets[target_count++] = pos + d;
		break;
	case FIREBALL:
		for (Coords p = pos + dir; !BLOCKS_LOS(p); p += dir)
			targets[target_count++] = p;
		break;
	case CONE_OF_COLD:
		for (Coords d: cone_shape)
			targets[target_count++] = pos + d * dir.x;
		break;
	case SPORES:
		for (Coords d: square_shape)
			if (L1(d))
				targets[target_count++] = pos + d;
		break;
	case ELECTRICITY:
		for (Monster *m = &player; m->type; ++m) {
			targets[target_count] = m->pos;
			target_count += m->electrified;
			m->electrified = false;
		}
		break;
	case BOUNCE_TRAP:
		break;
	}

	for (const char **step = animation_steps[(i64) id]; **step; ++step) {
		for (i64 i = 0; i < target_count; ++i)
			if (TILE(pos).revealed && TILE(targets[i]).revealed)
				print_at(targets[i], *step);
		fflush(stdout);
		struct timeval timeout = { .tv_usec = 42000 };
		fd_set in_fds;
		FD_SET(0, &in_fds);
		select(1, &in_fds, NULL, NULL, &timeout);
	}
}

// `play` entry point: an interactive interface to the simulation.
int main(i32 argc, char **argv)
{
	g.seed = (u32) time(NULL);
	xml_parse(argc, argv);
	run_animations = true;

	system("stty -echo -icanon eol \1");
	printf("\033[?25l\033[?1003;1049h");
	atexit([]() { printf("\033[?25h\033[?1003;1049l"); });

	GameState timeline[32] = {[0 ... 31] = g};

	for (;;) {
		timeline[g.current_beat & 31] = g;
		display_all();
		i32 c = getchar();
		if (c == 't')
			execv(*argv, argv);
		else if (c == 'u')
			g = timeline[(g.current_beat - 1) & 31];
		else if (c == '\033' && scanf("[M%*c%c%c", &cursor.x, &cursor.y))
			cursor += {-33, -33};
		else if (c == EOF || c == 4 || c == 'q')
			break;
		else if (!g.game_over)
			g.game_over = do_beat((char) c);
	}
}
Exemplo n.º 23
0
int main(void)
    {
    List *addr_list = NULL;
    DLL_Return ExitCode;

    if(DLL_CreateList(&addr_list) == NULL)
        {
        fputs("Fatal memory error\n", stderr);
        exit(EXIT_FAILURE);
        }

    if((ExitCode = DLL_InitializeList(addr_list, sizeof(NameAddr)))
      != DLL_NORMAL)
        {
        (void)(ExitCode == DLL_ZERO_INFO
          && fputs("Size of address record is zero.\n\n", stderr));
        (void)(ExitCode == DLL_NULL_LIST
          && fputs("addr_list points to a NULL.\n\n", stderr));
        exit(EXIT_FAILURE);
        }

    printf("%s\n", DLL_Version());

    for(;;)
        {
        switch(main_menu())
            {
            case 1:
                enter(addr_list);
                break;
            case 2:
                insert(addr_list);
                break;
            case 3:
                update(addr_list);
                break;
            case 4:
                search(addr_list);
                break;
            case 5:
                display_all(addr_list);
                break;
            case 6:
                get_current_record(addr_list);
                break;
            case 7:
                delete_current_record(addr_list);
                break;
            case 8:
                get_prior_record(addr_list);
                break;
            case 9:
                get_next_record(addr_list);
                break;
            case 10:
                get_first_record(addr_list);
                break;
            case 11:
                get_last_record(addr_list);
                break;
            case 12:
                swap_record(addr_list);
                break;
            case 13:
                save(addr_list);
                break;
            case 14:
                load(addr_list);
                break;
            case 15:
                number_of_records(addr_list);
                break;
            case 16:
                DLL_DestroyList(&addr_list);

#if	DEBUG
                if(addr_list != NULL)
                    {
                    fputs("Error: List was not destroyed.\n", stderr);
                    exit(EXIT_FAILURE);
                    }
#endif

                exit(EXIT_SUCCESS);
            }
        }

    return 0;
    }