#include<iostream>
using namespace std;
void menu01()
{
cout<<"您选择了项目1"<<endl;
cout<<"请选择该栏目书名:"<<endl;
cout<<"1.《欢乐的经济学》---23元"<<endl;
cout<<"2.《拖延心理学》---24元"<<endl;
cout<<"3.《万历十五年》---29元"<<endl;
cout<<"4.《中国哲学史》---99元"<<endl;
cout<<"0.返回上一级菜单"<<endl;
cout<<"请选择您想要的书"<<endl;
L:int n;
cin>>n;
int m;
switch(n)
{
case 1:cout<<"您选择了《欢乐的经济学》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*23<<"元"<<endl;
system("pause");break;
case 2:cout<<"您选择了《拖延心理学》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*24<<"元"<<endl;
system("pause");break;
case 3:cout<<"您选择了《万历十五年》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*29<<"元"<<endl;
system("pause");break;
case 4:cout<<"您选择了《中国哲学史》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*99<<"元"<<endl;
system("pause");break;
case 0:cout<<"已返回上一级,请选择图书项目"<<endl;
system("pause");
break;
default:cout<<"非法输入。请输入1-4选择您想要的书,或输入0返回上一级菜单"<<endl;
goto L;
}
}
void menu02()
{
cout<<"您选择了项目2"<<endl;
cout<<"请选择该栏目书名:"<<endl;
cout<<"1.《三体》--44"<<endl;
cout<<"2.《流浪地球》--48"<<endl;
cout<<"3.《闪电式扩张》--56"<<endl;
cout<<"4.《科技通史》--32"<<endl;
cout<<"0.返回上一级菜单"<<endl;
cout<<"请选择您想要的书"<<endl;
L:int n;
cin>>n;
int m;
switch(n)
{
case 1:cout<<"您选择了《三体》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*44<<"元"<<endl;
system("pause");break;
case 2:cout<<"您选择了《流浪地球》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*48<<"元"<<endl;
system("pause");break;
case 3:cout<<"您选择了《闪电式扩张》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*56<<"元"<<endl;
system("pause");break;
case 4:cout<<"您选择了《科技通史》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*32<<"元"<<endl;
system("pause");break;
case 0:cout<<"已返回上一级,请选择图书项目"<<endl;
system("pause");
break;
default:cout<<"非法输入。请输入1-4选择您想要的书,或输入0返回上一级菜单"<<endl;
goto L;
}
}
void menu03()
{
cout<<"您选择了项目3"<<endl;
cout<<"请选择该栏目书名:"<<endl;
cout<<"1.《水浒传》--95"<<endl;
cout<<"2.《西游记》--128"<<endl;
cout<<"3.《红楼梦》--64"<<endl;
cout<<"4.《三国演义》--267"<<endl;
cout<<"0.返回上一级菜单"<<endl;
cout<<"请选择您想要的书"<<endl;
L:int n;
cin>>n;
int m;
switch(n)
{
case 1:cout<<"您选择了《水浒传》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*95<<"元"<<endl;
system("pause");break;
case 2:cout<<"您选择了《西游记》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*128<<"元"<<endl;
system("pause");break;
case 3:cout<<"您选择了《红楼梦》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*64<<"元"<<endl;
system("pause");break;
case 4:cout<<"您选择了《三国演义》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*267<<"元"<<endl;
system("pause");break;
case 0:cout<<"已返回上一级,请选择图书项目"<<endl;
system("pause");
break;
default:cout<<"非法输入。输入1-4选择您想要的书,或输入0返回上一级菜单"<<endl;
goto L;
}
}
void menu04()
{
cout<<"您选择了项目4"<<endl;
cout<<"请选择该栏目书名:"<<endl;
cout<<"1.《安徒生童话》--156"<<endl;
cout<<"2.《格林童话》--34"<<endl;
cout<<"3.《DK儿童百科》--48"<<endl;
cout<<"4.《暖房子绘本》--25"<<endl;
cout<<"0.返回上一级菜单"<<endl;
cout<<"请选择您想要的书"<<endl;
L:int n;
cin>>n;
int m;
switch(n)
{
case 1:cout<<"您选择了《安徒生童话》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*156<<"元"<<endl;
system("pause");break;
case 2:cout<<"您选择了《格林童话》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*34<<"元"<<endl;
system("pause");break;
case 3:cout<<"您选择了《DK儿童百科》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*48<<"元"<<endl;
system("pause");break;
case 4:cout<<"您选择了《暖房子绘本》"<<endl;
cout<<"请输入您需要购买的数量"<<endl;
cin>>m;
cout<<"您共需支付"<<m*25<<"元"<<endl;
system("pause");break;
case 0:cout<<"已返回上一级,请选择图书项目"<<endl;
system("pause");
break;
default:cout<<"非法输入。请输入1-4选择您想要的书,或输入0返回上一级菜单"<<endl;
goto L;
}
}
int main()
{
system("color 30");
int k;
while(1)
{
cout<<"欢迎使用图书管理系统:"<<endl;
cout<<"1.人文社科类"<<endl;
cout<<"2.科技创新类"<<endl;
cout<<"3.经典小说类"<<endl;
cout<<"4.少儿启蒙类"<<endl;
cout<<"0.退出系统"<<endl;
cout<<"请选择书的种类:(1-4&&0)"<<endl;
cin>>k;
switch(k)
{
case 1:menu01();break;
case 2:menu02();break;
case 3:menu03();break;
case 4:menu04();break;
case 0:cout<<"谢谢使用,欢迎下次使用"<<endl;
return 0;
break;
default:cout<<"非法输入。请输入1-4选择您想要的书的种类,或输入0退出图书管理系统"<<endl;
system("pause");
break;
return 0;
}
system("cls");
}
}
测试结果
|