#include<iostream>
#include<iomanip>//s
#include<fstream>//w
#include<string>
using namespace std;
class cmenu
{
int num;
string name;
float price;
string kind;
int sort;
public:
void getnum(int a);
void getname(string b);
void getprice(float c);
void getkind(string d);
void getsort(int e);
void displaymenu();
void selectmenu();
int returnnum()
{
return num;
}
string returnname()
{
return name;
}
float returnprice()
{
return price;
}
string returnkind()
{
return kind;
}
int returnsort()
{
return sort;
}
};
void cmenu::getnum(int a)
{
num=a;
}
void cmenu::getname(string b)
{
name=b;
}
void cmenu::getprice(float c)
{
price=c;
}
void cmenu::getkind(string d)
{
kind=d;
}
void cmenu::getsort(int e)
{
sort=e;
}
void cmenu::displaymenu()
{
cout<<setw(3)<<num<<setw(24)<<name<<setw(16)<<kind<<setw(16)<<price<<endl;
}
void cmenu::selectmenu()
{
cout<<setw(3)<<num<<setw(24)<<name<<setw(16)<<kind<<setw(16)<<price<<setw(19)<<sort<<endl;
}
class array
{
public:
void getnum(int a);
void getsort(int b);
int returnnum()
{
return num;
}
int returnsort()
{
return sort;
}
private:
int sort,num;
};
void array::getnum(int a)
{
num=a;
}
void array::getsort(int b)
{
sort=b;
}
int main()
{
int i,id,m,q,z,sort,b,j,number,num;
string name,kind;
float point,price,sum=0;
cmenu food[40];
ifstream f1("menu.txt");
for(j=0;j<12;j++)
{
f1>>num;
f1>>name;
f1>>kind;
f1>>price;
food[0].getnum(1);
food[0].getkind("炒菜");
food[0].getname("麻辣豆腐");
food[0].getprice(8);
food[1].getnum(2);
food[1].getkind("炒菜");
food[1].getname("烧茄子");
food[1].getprice(10);
food[2].getnum(3);
food[2].getkind("炒菜");
food[2].getname("鱼香肉丝");
food[2].getprice(15);
food[3].getnum(4);
food[3].getkind("炒菜");
food[3].getname("锅包肉");
food[3].getprice(15);
food[4].getnum(5);
food[4].getkind("炒饭");
food[4].getname("蛋炒饭");
food[4].getprice(5);
food[5].getnum(6);
food[5].getkind("炒饭");
food[5].getname("扬州炒饭");
food[5].getprice(6);
food[6].getnum(7);
food[6].getkind("炒饭");
food[6].getname("火腿炒饭");
food[6].getprice(6);
food[7].getnum(8);
food[7].getkind("炒饭");
food[7].getname("鱿鱼炒饭");
food[7].getprice(7);
food[8].getnum(9);
food[8].getkind("面类");
food[8].getname("刀削面");
food[8].getprice(5);
food[9].getnum(10);
food[9].getkind("面类")
点菜系统(课程设计)
最新推荐文章于 2024-05-23 11:09:39 发布
![](https://img-home.csdnimg.cn/images/20240611030827.png)