该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
printf(
"\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\30\n");
printf("\n");
printf("\4菜单选择:");
scanf("%d", &choose);
switch (choose)
{
case 1:
ShowAddBook();
break;
case 2:
ShowDelBook();
break;
case 3:
ShowEditBook();
break;
case 4:
ShowFindBook();
break;
case 5:
ShowExit();
break;
default:
system("cls");
printf("\4请输入正确菜单编号(提示:1-5)!\n");
ShowMain();
}
}
void ShowAddBook()
{
char key;
printf("==================添加图书=====================\n\n");
printf("请输入图书名称(例如:时间简史):");
scanf("%s", &book.name);
printf("请输入图书价格(例如:20):");
scanf("%s", &book.price);
printf("请输入图书出版日期(例如:2004-5):");
scanf("%s", &book.pubDate);
printf("请输入图书描述:");
scanf("%s", &book.desc);
printf("\n");
printf("输入完毕,确认添加?[y/n]");
scanf("%s", &key);
if (key == 'y')
{
AddBookToDB(book.name, book.price, book.pubDate, book.desc);
}
Sleep(1000);
system("cls");
ShowMain();
}
void ShowDelBook()
{
printf("==================删除图书=====================\n\n");
printf("请输入图书名:");
scanf("%s", &book.name);
DeleteBookFromDB(book.name);
Sleep(1000);
system("cls");
ShowMain();
}
void ShowEditBook()
{
char key;
char newname[50];
char newpubdate[20];
char newprice[5];
char newdesc[50];
printf("==================修改图书信息=====================\n\n");
printf("请输入图书名:");
scanf("%s", &book.name);
printf("\n\n");
printf("==================图书《%s》基本信息=====================\n",
book.name);
printf("%s %s %s %s\n", "书名\31",
"出版时间\31", "价格\31", "简介\31");
printf("================================================================\n");
FindBookFromDB(book.name);
printf("============================================================\n");
printf("提示:不修改则请输入数字0\n");
printf("\n输入新书名:");
scanf("%s", &newname);
printf("\n输入新出版时间:");