Exemplo n.º 1
0
int main()
{
	//show_menu_main();
	BAN b[10];
	int iIndex =0;//No Data
	int choice;
label:	show_menu_main();
	printf("Input that you want choice : \n");
	scanf("%d",&choice);
	switch(choice){
	case 1:
		{
		Show_Create();
		InputMember(b,&iIndex,
			sizeof(b)/sizeof(b[0]));// Input run pointer point to iIndex address, get value iIndex ++
		goto label;
		break;
		}
	case 2:
		{
			Show_Output();
			PrintAll(b,iIndex);
			goto label;
			break;
		}
	case 3:
		Show_Searching();
		int chon;
		printf("Input choice that you searching!!!\n");
		scanf("%d",&chon);
		switch(chon){
		case 1:
			Searching_by_name(b,&iIndex);
			goto label;
			break;
		case 2:
			Searching_by_id(b,iIndex);
			goto label;
			break;
		}
	case 4:
		Show_Modify();
		Modify(b,iIndex);
		goto label;
		break;
	case 11:
		show_menu_EDIT();
		Edit(b,iIndex);
		goto label;
		break;
	case 5:
		show_list_delete();		
		//Delete(b,&iIndex);
		Delete_me(b,&iIndex);
		//PrintAll(b,iIndex);
		goto label;
		break;
	case 6:
		Show_delete_All();
		int de;
		printf("YOU WANT CHOICE ");
		scanf("%d",&de);
		switch(de){
		case 1:
			DeleteAll(b,&iIndex);
			goto label;
			break;
		case 2:
			goto label;
			break;
		}
	case 7:
		{
		show_menu_sort();
		int sort;
		printf("Please Input choice to sort data\n");
		scanf("%d",&sort);
		switch(sort){
		case 1:
			insertSort(b,iIndex);
			PrintAll(b,iIndex);
			goto label;
			break;
		case 2:
			sort_by_shell(b,iIndex);
			goto label;
			break;
		case 3:
			QuickSort(b,0,iIndex-1);
			PrintAll(b,iIndex);
			goto label;
			break;
		case 4:
			Merger_Sort_vision(b,0,iIndex-1);
			PrintAll(b,iIndex);
			goto label;
			break;
		}
		}
		break;
	case 8:
			save(b,iIndex);
			goto label;
		break;
	case 9:
		Show_data_read_file();
		ReadFile_1(b,iIndex,"ds.txt");
		goto label;
		break;
	case 10:
		exit(0);
		break;
	}
	return 0;
}
void main()
{
	char mode = '1';
	char cManageMember = '1';
	char cManageVideo = '1';
	char cManageRental = '1';
	LINKEDLIST Memberlist;
	Memberlist.InitList = InitLinkedList;
	Memberlist.InitList(&Memberlist, AddTop, AddBottom, DeleteAt, DeleteTop, DeleteBottom, DeleteAll);

	LINKEDLIST Videolist;
	Videolist.InitList = InitLinkedList;
	Videolist.InitList(&Videolist, AddTop, AddBottom, DeleteAt, DeleteTop, DeleteBottom, DeleteAll);

	LINKEDLIST Rentallist;
	Rentallist.InitList = InitLinkedList;
	Rentallist.InitList(&Rentallist, AddTop, AddBottom, DeleteAt, DeleteTop, DeleteBottom, DeleteAll);

	while (mode != '0'){
		printf("\nmode 선택 ( 1 = 사용자 관리 , 2 = 비디오 관리 , 3 = 대여 관리, 0 = 종료) \n");
		mode = getchar();
		fflush(stdin);

		switch (mode)
		{
		case '1':
			printf("\nmode 선택 ( 1 = 회원 등록 , 2 = 회원 목록 , 3 = 회원 검색, 4 = 회원 정보수정 ,5 = 회원 삭제 0 = 돌아가기) \n");
			cManageMember = getchar();
			fflush(stdin);
			switch (cManageMember){
			case '1':
				InputMember(&Memberlist);
				break;
			case '2':
				vPrintMember(&Memberlist);
				break;
			case '3':
				SearchMember(&Memberlist);
				break;
			case '4':
				ModifyMember(&Memberlist);
				break;
			case '5':
				DeleteMember(&Memberlist);
				break;
			default:
				cManageMember = '0';
				break;
			}
			break;
		case '2':
			printf("\nmode 선택 ( 1 = 비디오 등록 , 2 = 비디오 목록 , 3 = 비디오 검색, 4 = 비디오 정보수정 ,5 = 비디오 삭제 0 = 돌아가기) \n");
			cManageVideo = getchar();
			fflush(stdin);
			switch (cManageVideo){
			case '1':
				InputVideo(&Videolist);
				break;
			case '2':
				vPrintVideo(&Videolist);
				break;
			case '3':
				SearchVideo(&Videolist);
				break;
			case '4':
				ModifyVideo(&Videolist);
				break;
			case '5':
				DeleteVideo(&Videolist);
				break;
			default:
				cManageVideo = '0';
				break;
			}
			break;
		case '3':
			printf("\nmode 선택 ( 1 = 비디오 대여 , 2 = 비디오 반납 , 3 = 비디오 대여목록 ,0 = 돌아가기) \n");
			cManageRental = getchar();
			fflush(stdin);
			switch (cManageRental){
			case '1':
				InputRental(&Memberlist, &Videolist, &Rentallist);
				break;
			case '2':
				ReturnVideo(&Rentallist);
				break;
			case '3':
				PrintRentallist(&Rentallist);
				break;
			}
		}
	}
}