?系统运行步骤陈述:
- 运行程序进入用户登陆界面,输入账户及密码
- 如果账户以及密码输入正确则进入系统,显示登陆成功
- 紧接着以下须按照指示输入,所输入字母不区分大小写
- 进入系统后便可看见菜单选项,a,b,c,d,e五类菜及各类菜里面的菜品全称,简称和单价,以及八种口味及编号
- 按照提示输入自己想吃的哪类菜编号
- 进入该类菜之后输入想吃菜品的简称
- 下一步会提示输入口味,则输入口味编号
- 下一步会提示继续选择自己想吃的一类菜,继续的话则根据菜单输入相关字母,想退出的话直接按'q'或'Q'
- 则会统计所选菜的总数以及所选各类菜总价格(代码一见显示屏,代码二见statis.txt文件)
?源程序里面的注释我都给的很详细,就不在这里一一介绍啦,还是那句老话,写的很仓促,存在很多问题,希望大家不要见笑哈!下面给出两种代码。注意,两个功能完全一样,区别在于代码一输出在屏幕,代码二输出给文件。
源代码如下:?
代码一:(输入数据显示在屏幕上)
//ordersystem
//author:babysen
//date:2022/01/05-06
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
const int strsize = 30;
const string flavor[8] = {"三鲜", "甜", "微微辣", "微辣", "麻辣", "中辣", "超辣", "番茄"}; //口味
//构造显示函数:
void display_menu(); //显示菜单
void display_name(); //菜名
void display_preference(); //显示咸淡口味
//void display_sex(); //统计男女生人数
//构建结构体,其中s是性别的另一种表达,s=0,1;0为女性,1为男性
struct order
{
char fullname[strsize]; //菜全名
char abbreviation[strsize]; //菜简称
int price; //价格
};
//输入结构体数组的内容
//热卖推荐菜单
order hsr[5] =
{
{"香锅", "香锅", 15},
{"肉夹馍", "夹馍", 7},
{"羊肉泡馍", "泡馍", 24},
{"洛阳烩菜", "烩菜", 7},
{"泡面加蛋", "煮泡面", 6}};
//饺子菜单
order dump[8] =
{
{"大份大肉莲菜", "大份莲菜", 10},
{"小份大肉莲菜", "小份莲菜", 8},
{"大份韭菜鸡蛋", "大份韭菜", 10},
{"小份韭菜鸡蛋", "小份韭菜", 8},
{"大份大葱牛肉", "大份牛肉", 12},
{"小份大葱牛肉", "小份牛肉", 10},
{"大份大葱羊肉", "大份羊肉", 12},
{"小份大葱羊肉", "小份羊肉", 10}};
//面食菜单
order noodle[10] =
{
{"大碗三合一面", "大碗三合一", 11},
{"小碗三合一面", "小碗三合一", 10},
{"大碗二合一面", "大碗二合一", 10},
{"小碗二合一面", "小碗二合一", 9},
{"大碗油泼面", "大碗油泼", 9},
{"小碗油泼面", "小碗油泼", 8},
{"大碗拉条子面", "大碗拉条子", 9},
{"小碗拉条子面", "小碗拉条子", 8},
{"大碗棍棍面", "大碗棍棍", 9},
{"小碗棍棍面", "小碗棍棍", 8}};
//米饭菜单
order rice[7] =
{
{"两荤两素", "两荤两素", 8},
{"一荤三素", "一荤三素", 8},
{"一荤两素", "一荤两素", 7},
{"三样素菜", "三样素菜", 6},
{"小炒肉盖浇饭", "小炒肉", 11},
{"茄子盖浇饭", "茄子", 9},
{"番茄鸡蛋盖浇饭", "番茄鸡蛋", 9}};
//特色小吃菜单
order spes[4] =
{
{"一份油条", "油条", 4},
{"陕西凉皮", "凉皮", 6},
{"豆腐脑", "豆腐脑", 2},
{"葫芦头泡馍", "葫芦头", 13}};
//定义菜单函数
void display_menu()
{
cout << "-----------------------------------------" << endl;
cout << "| 餐厅菜单表 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| a.热卖推荐 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| b.饺子 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| c.面条 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| d.米饭 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| e.特色小吃 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| q.退出并统计 |" << endl;
cout << "-----------------------------------------" << endl;
}
//定义菜名函数
void display_name()
{
cout << "a.热卖推荐菜单如下: " << endl;
for (int i = 0; i < 5; i++)
cout << "菜名: " << hsr[i].fullname << ","
<< "简称: " << hsr[i].abbreviation << ","
<< "单价: " << hsr[i].price << endl;
cout << "b.饺子: " << endl;
for (int i = 0; i < 8; i++)
cout << "菜名: " << dump[i].fullname << ","
<< "简称: " << dump[i].abbreviation << ","
<< "单价: " << dump[i].price << endl;
cout << "c.面条: " << endl;
for (int i = 0; i < 10; i++)
cout << "菜名: " << noodle[i].fullname << ","
<< "简称: " << noodle[i].abbreviation << ","
<< "单价: " << noodle[i].price << endl;
cout << "d.米饭: " << endl;
for (int i = 0; i < 7; i++)
cout << "菜名: " << rice[i].fullname << ","
<< "简称: " << rice[i].abbreviation << ","
<< "单价: " << rice[i].price << endl;
cout << "e.特色小吃: " << endl;
for (int i = 0; i < 4; i++)
cout << "菜名: " << spes[i].fullname << ","
<< "简称: " << spes[i].abbreviation << ","
<< "单价: " << spes[i].price << endl;
}
//定义个人口味函数
void display_preference()
{
cout << "--------------------------------------" << endl;
cout << "| 1.三鲜, 2.甜, 3.微微辣, 4.微辣 |" << endl;
cout << "| 5.麻辣, 6.中辣, 7.超辣, 8.番茄 |" << endl;
cout << "--------------------------------------" << endl;
}
//统计男女生人数函数
/* void display_sex()
{
for (int i = 0; i < NUM; i++)
cout << people[i].fullname << " 's sex is: " << people[i].sex << endl;
} */
int main()
{
//1.初始化,设定账号和密码。
long int ID = 20220106;
int num = 6; //输入密码机会
//2.建立存储信息的变量。
long int id;
//3.完成do-while循环结构中输入的内容
cout << "请输入账号: ";
cin >> id;
int i = 0;
//初始化一个空字符串,s是密码字符串
string pwd = "", s = "666666";
cout << "请输入密码: ";
char c;
while (true)
{
c = getch();
if (c != 13) //如果不是回车,就不断往string类型的pwd内添加c
{
pwd = pwd + c;
cout << "*";
}
else
{
if (pwd == s && id == ID)
{
cout << endl;
cout << " 登陆成功 " << endl;
cout << "-----------------------------------------" << endl;
char ch; //菜种类选择序号
int nn; //口味选择序号
double p0[5]; //a类菜的价钱
double p1[8]; //b类菜的价钱
double p2[10]; //c类菜的价钱
double p3[7]; //d类菜的价钱
double p4[3]; //e类菜的价钱
long int total[34] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //各菜初始点餐数量
cout << "| 欢迎光临食堂就餐,菜单如下: |" << endl;
display_menu();
cout << endl;
display_name();
cout << endl;
display_preference();
cout << "_________________________________" << endl;
cout << "_________________________________" << endl;
cout << "请用字母输入您想吃哪个种类的菜品: " << endl;
while (cin >> ch && ch != 'q' && ch != 'Q')
{
cout << "输入菜名简称" << endl;
string na; //菜名简称
switch (ch) //case分支大括号可以不要,这里为了方便观看加上了
{
case 'a':
case 'A':
{
cin >> na;
if (na == "香锅")
total[0]++;
else if (na == "夹馍")
total[1]++;
else if (na == "泡馍")
total[2]++;
else if (na == "烩菜")
total[3]++;
else if (na == "煮泡面")
total[4]++;
}
break;
case 'b':
case 'B':
{
cin >> na;
if (na == "大份莲菜")
total[5]++;
else if (na == "小份莲菜")
total[6]++;
else if (na == "大份韭菜")
total[7]++;
else if (na == "小份韭菜")
total[8]++;
else if (na == "大份牛肉")
total[9]++;
else if (na == "小份牛肉")
total[10]++;
else if (na == "大份羊肉")
total[11]++;
else if (na == "小份羊肉")
total[12]++;
}
break;
case 'c':
case 'C':
{
cin >> na;
if (na == "大碗三合一")
total[13]++;
else if (na == "小碗三合一")
total[14]++;
else if (na == "大碗二合一")
total[15]++;
else if (na == "小碗二合一")
total[16]++;
else if (na == "大碗油泼")
total[17]++;
else if (na == "小碗油泼")
total[18]++;
else if (na == "大碗拉条子")
total[19]++;
else if (na == "小碗拉条子")
total[20]++;
else if (na == "大碗棍棍")
total[21]++;
else if (na == "小碗棍棍")
total[22]++;
}
break;
case 'd':
case 'D':
{
cin >> na;
if (na == "两荤两素")
total[23]++;
else if (na == "一荤三素")
total[24]++;
else if (na == "一荤两素")
total[25]++;
else if (na == "三样素菜")
total[26]++;
else if (na == "小炒肉")
total[27]++;
else if (na == "茄子")
total[28]++;
else if (na == "番茄鸡蛋")
total[29]++;
}
break;
case 'e':
case 'E':
{
cin >> na;
if (na == "油条")
total[30]++;
else if (na == "凉皮")
total[31]++;
else if (na == "豆腐脑")
total[32]++;
else if (na == "葫芦头")
total[33]++;
}
break;
}
cout << "输入口味选项:" << endl;
cin >> nn;
while (nn != 0)
{
switch (nn)
{
case 1:
cout << flavor[0] << endl;
break;
case 2:
cout << flavor[1] << endl;
break;
case 3:
cout << flavor[2] << endl;
break;
case 4:
cout << flavor[3] << endl;
break;
case 5:
cout << flavor[4] << endl;
break;
case 6:
cout << flavor[5] << endl;
break;
case 7:
cout << flavor[6] << endl;
break;
case 8:
cout << flavor[7] << endl;
break;
default:
cout << "选择错误" << endl;
}
break;
}
cout << "请继续用字母输入您想吃哪个种类的菜品: " << endl;
}
for (int i = 0; i < 5; i++)
{
p0[i] = total[i] * hsr[i].price;
cout << "a类各菜品点餐数如下: " << endl;
cout << hsr[i].fullname << " " << total[i] << " 份" << endl;
cout << "a类各菜品销售额如下: " << endl;
p0[i] = total[i] * hsr[i].price;
cout << hsr[i].fullname << " " << p0[i] << " 元" << endl;
}
for (int i = 0; i < 8; i++)
{
cout << "b类各菜品点餐数如下: " << endl;
cout << dump[i].fullname << " " << total[i + 5] << " 份" << endl;
cout << "b类各菜品销售额如下: " << endl;
p1[i] = total[i + 5] * dump[i].price;
cout << dump[i].fullname << " " << p1[i] << " 元" << endl;
}
for (int i = 0; i < 10; i++)
{
cout << "c类各菜品点餐数如下: " << endl;
cout << noodle[i].fullname << " " << total[i + 13] << " 份" << endl;
cout << "c类各菜品销售额如下: " << endl;
p2[i] = total[i + 13] * noodle[i].price;
cout << noodle[i].fullname << " " << p2[i] << " 元" << endl;
}
for (int i = 0; i < 7; i++)
{
cout << "d类各菜品点餐数如下: " << endl;
cout << rice[i].fullname << " " << total[i + 23] << " 份" << endl;
cout << "d类各菜品销售额如下: " << endl;
p3[i] = total[i + 23] * rice[i].price;
cout << rice[i].fullname << " " << p3[i] << " 元" << endl;
}
for (int i = 0; i < 3; i++)
{
cout << "e类各菜品点餐数如下: " << endl;
cout << spes[i].fullname << " " << total[i + 30] << " 份" << endl;
cout << "e类各菜品销售额如下: " << endl;
p4[i] = total[i + 30] * spes[i].price;
cout << spes[i].fullname << " " << p4[i] << " 元" << endl;
}
break;
}
else
{
if (num == 1)
{
cout << "今日次数已用完!";
break;
}
else
{
cout << endl;
cout << "账户或密码错误,还剩余" << --num << "次机会" << endl;
cout << "请输入账号: ";
cin >> id;
cout << "请输入密码: ";
pwd = "";
}
}
}
}
void free();
system("pause");
return 0;
}
代码二:(输出数据到文件上)?
//ordersystem
//author:babysen
//date:2022/01/05-07
#include <iostream>
#include <string>
#include <fstream>
#include <conio.h>
using namespace std;
const int strsize = 30;
const string flavor[8] = {"三鲜", "甜", "微微辣", "微辣", "麻辣", "中辣", "超辣", "番茄"}; //口味
//构造显示函数:
void display_menu(); //显示菜单
void display_name(); //菜名
void display_preference(); //显示咸淡口味
//void display_sex(); //统计男女生人数
//构建结构体,其中s是性别的另一种表达,s=0,1;0为女性,1为男性
struct order
{
char fullname[strsize]; //菜全名
char abbreviation[strsize]; //菜简称
int price; //价格
};
//输入结构体数组的内容
//热卖推荐菜单
order hsr[5] =
{
{"香锅", "香锅", 15},
{"肉夹馍", "夹馍", 7},
{"羊肉泡馍", "泡馍", 24},
{"洛阳烩菜", "烩菜", 7},
{"泡面加蛋", "煮泡面", 6}};
//饺子菜单
order dump[8] =
{
{"大份大肉莲菜", "大份莲菜", 10},
{"小份大肉莲菜", "小份莲菜", 8},
{"大份韭菜鸡蛋", "大份韭菜", 10},
{"小份韭菜鸡蛋", "小份韭菜", 8},
{"大份大葱牛肉", "大份牛肉", 12},
{"小份大葱牛肉", "小份牛肉", 10},
{"大份大葱羊肉", "大份羊肉", 12},
{"小份大葱羊肉", "小份羊肉", 10}};
//面食菜单
order noodle[10] =
{
{"大碗三合一面", "大碗三合一", 11},
{"小碗三合一面", "小碗三合一", 10},
{"大碗二合一面", "大碗二合一", 10},
{"小碗二合一面", "小碗二合一", 9},
{"大碗油泼面", "大碗油泼", 9},
{"小碗油泼面", "小碗油泼", 8},
{"大碗拉条子面", "大碗拉条子", 9},
{"小碗拉条子面", "小碗拉条子", 8},
{"大碗棍棍面", "大碗棍棍", 9},
{"小碗棍棍面", "小碗棍棍", 8}};
//米饭菜单
order rice[7] =
{
{"两荤两素", "两荤两素", 8},
{"一荤三素", "一荤三素", 8},
{"一荤两素", "一荤两素", 7},
{"三样素菜", "三样素菜", 6},
{"小炒肉盖浇饭", "小炒肉", 11},
{"茄子盖浇饭", "茄子", 9},
{"番茄鸡蛋盖浇饭", "番茄鸡蛋", 9}};
//特色小吃菜单
order spes[4] =
{
{"一份油条", "油条", 4},
{"陕西凉皮", "凉皮", 6},
{"豆腐脑", "豆腐脑", 2},
{"葫芦头泡馍", "葫芦头", 13}};
//定义菜单函数
void display_menu()
{
cout << "-----------------------------------------" << endl;
cout << "| 餐厅菜单表 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| a.热卖推荐 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| b.饺子 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| c.面条 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| d.米饭 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| e.特色小吃 |" << endl;
cout << "-----------------------------------------" << endl;
cout << "| q.退出并统计 |" << endl;
cout << "-----------------------------------------" << endl;
}
//定义菜名函数
void display_name()
{
cout << "a.热卖推荐菜单如下: " << endl;
for (int i = 0; i < 5; i++)
cout << "菜名: " << hsr[i].fullname << ","
<< "简称: " << hsr[i].abbreviation << ","
<< "单价: " << hsr[i].price << endl;
cout << "b.饺子: " << endl;
for (int i = 0; i < 8; i++)
cout << "菜名: " << dump[i].fullname << ","
<< "简称: " << dump[i].abbreviation << ","
<< "单价: " << dump[i].price << endl;
cout << "c.面条: " << endl;
for (int i = 0; i < 10; i++)
cout << "菜名: " << noodle[i].fullname << ","
<< "简称: " << noodle[i].abbreviation << ","
<< "单价: " << noodle[i].price << endl;
cout << "d.米饭: " << endl;
for (int i = 0; i < 7; i++)
cout << "菜名: " << rice[i].fullname << ","
<< "简称: " << rice[i].abbreviation << ","
<< "单价: " << rice[i].price << endl;
cout << "e.特色小吃: " << endl;
for (int i = 0; i < 4; i++)
cout << "菜名: " << spes[i].fullname << ","
<< "简称: " << spes[i].abbreviation << ","
<< "单价: " << spes[i].price << endl;
}
//定义个人口味函数
void display_preference()
{
cout << "--------------------------------------" << endl;
cout << "| 1.三鲜, 2.甜, 3.微微辣, 4.微辣 |" << endl;
cout << "| 5.麻辣, 6.中辣, 7.超辣, 8.番茄 |" << endl;
cout << "--------------------------------------" << endl;
}
//统计男女生人数函数
/* void display_sex()
{
for (int i = 0; i < NUM; i++)
cout << people[i].fullname << " 's sex is: " << people[i].sex << endl;
} */
//主函数
int main()
{
//数据写入文件
ofstream outfile("statis.txt", ios::out); //输出结果存储在statis文件中
if (!outfile)
{
cerr << "open error!" << endl;
exit(1);
}
//1.初始化,设定账号和密码。
long int ID = 20220106;
int num = 6; //输入密码次数
//2.建立存储信息的变量。
long int id;
//3.完成do-while循环结构中输入的内容
cout << "请输入账号: ";
cin >> id;
int i = 0;
//初始化一个空字符串,s是密码字符串
string pwd = "", s = "666666";
cout << "请输入密码: ";
char c;
while (true)
{
c = getch();
if (c != 13) //如果不是回车,就不断往string类型的pwd内添加c
{
pwd = pwd + c;
cout << "*";
}
else
{
if (pwd == s && id == ID)
{
cout << endl;
cout << " 登陆成功 " << endl;
cout << "-----------------------------------------" << endl;
char ch; //菜种类选择序号
int nn; //口味选择序号
double p0[5]; //a类菜的价钱
double p1[8]; //b类菜的价钱
double p2[10]; //c类菜的价钱
double p3[7]; //d类菜的价钱
double p4[3]; //e类菜的价钱
long int total[34] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //各菜初始点餐数量
cout << "欢迎光临学校食堂就餐,菜单如下: " << endl;
display_menu();
cout << endl;
display_name();
cout << endl;
display_preference();
cout << "_________________________________" << endl;
cout << "_________________________________" << endl;
cout << "请用字母输入您想吃哪个种类的菜品: " << endl;
while (cin >> ch && ch != 'q' && ch != 'Q')
{
cout << "输入菜名简称" << endl;
string na; //菜名简称
switch (ch) //case分支大括号可以不要,这里为了方便观看加上了
{
case 'a':
case 'A':
{
cin >> na;
if (na == "香锅")
total[0]++;
else if (na == "夹馍")
total[1]++;
else if (na == "泡馍")
total[2]++;
else if (na == "烩菜")
total[3]++;
else if (na == "煮泡面")
total[4]++;
}
break;
case 'b':
case 'B':
{
cin >> na;
if (na == "大份莲菜")
total[5]++;
else if (na == "小份莲菜")
total[6]++;
else if (na == "大份韭菜")
total[7]++;
else if (na == "小份韭菜")
total[8]++;
else if (na == "大份牛肉")
total[9]++;
else if (na == "小份牛肉")
total[10]++;
else if (na == "大份羊肉")
total[11]++;
else if (na == "小份羊肉")
total[12]++;
}
break;
case 'c':
case 'C':
{
cin >> na;
if (na == "大碗三合一")
total[13]++;
else if (na == "小碗三合一")
total[14]++;
else if (na == "大碗二合一")
total[15]++;
else if (na == "小碗二合一")
total[16]++;
else if (na == "大碗油泼")
total[17]++;
else if (na == "小碗油泼")
total[18]++;
else if (na == "大碗拉条子")
total[19]++;
else if (na == "小碗拉条子")
total[20]++;
else if (na == "大碗棍棍")
total[21]++;
else if (na == "小碗棍棍")
total[22]++;
}
break;
case 'd':
case 'D':
{
cin >> na;
if (na == "两荤两素")
total[23]++;
else if (na == "一荤三素")
total[24]++;
else if (na == "一荤两素")
total[25]++;
else if (na == "三样素菜")
total[26]++;
else if (na == "小炒肉")
total[27]++;
else if (na == "茄子")
total[28]++;
else if (na == "番茄鸡蛋")
total[29]++;
}
break;
case 'e':
case 'E':
{
cin >> na;
if (na == "油条")
total[30]++;
else if (na == "凉皮")
total[31]++;
else if (na == "豆腐脑")
total[32]++;
else if (na == "葫芦头")
total[33]++;
}
break;
}
cout << "输入口味选项:" << endl;
cin >> nn;
while (nn != 0)
{
switch (nn)
{
case 1:
cout << flavor[0] << endl;
break;
case 2:
cout << flavor[1] << endl;
break;
case 3:
cout << flavor[2] << endl;
break;
case 4:
cout << flavor[3] << endl;
break;
case 5:
cout << flavor[4] << endl;
break;
case 6:
cout << flavor[5] << endl;
break;
case 7:
cout << flavor[6] << endl;
break;
case 8:
cout << flavor[7] << endl;
break;
default:
cout << "选择错误" << endl;
}
break;
}
cout << "请继续用字母输入您想吃哪个种类的菜品: " << endl;
}
for (int i = 0; i < 5; i++)
{
p0[i] = total[i] * hsr[i].price;
outfile << "a类各菜品点餐数如下: " << endl;
outfile << hsr[i].fullname << " " << total[i] << " 份" << endl;
outfile << "a类各菜品销售额如下: " << endl;
p0[i] = total[i] * hsr[i].price;
outfile << hsr[i].fullname << " " << p0[i] << " 元" << endl;
}
for (int i = 0; i < 8; i++)
{
outfile << "b类各菜品点餐数如下: " << endl;
outfile << dump[i].fullname << " " << total[i + 5] << " 份" << endl;
outfile << "b类各菜品销售额如下: " << endl;
p1[i] = total[i + 5] * dump[i].price;
outfile << dump[i].fullname << " " << p1[i] << " 元" << endl;
}
for (int i = 0; i < 10; i++)
{
outfile << "c类各菜品点餐数如下: " << endl;
outfile << noodle[i].fullname << " " << total[i + 13] << " 份" << endl;
outfile << "c类各菜品销售额如下: " << endl;
p2[i] = total[i + 13] * noodle[i].price;
outfile << noodle[i].fullname << " " << p2[i] << " 元" << endl;
}
for (int i = 0; i < 7; i++)
{
outfile << "d类各菜品点餐数如下: " << endl;
outfile << rice[i].fullname << " " << total[i + 23] << " 份" << endl;
outfile << "d类各菜品销售额如下: " << endl;
p3[i] = total[i + 23] * rice[i].price;
outfile << rice[i].fullname << " " << p3[i] << " 元" << endl;
}
for (int i = 0; i < 3; i++)
{
outfile << "e类各菜品点餐数如下: " << endl;
outfile << spes[i].fullname << " " << total[i + 30] << " 份" << endl;
outfile << "e类各菜品销售额如下: " << endl;
p4[i] = total[i + 30] * spes[i].price;
outfile << spes[i].fullname << " " << p4[i] << " 元" << endl;
}
break;
}
else
{
if (num == 1)
{
cout << "今日次数已用完!";
break;
}
else
{
cout << endl;
cout << "账户或密码错误,还剩余" << --num << "次机会" << endl;
cout << "请输入账号: ";
cin >> id;
cout << "请输入密码: ";
pwd = "";
}
}
}
}
outfile.close();
cout<<"处理完毕,请打开文件查看结果!"<<endl;
void free();
system("pause");
return 0;
}
?结果显示如下:
?
??
陈述在该系统所存在的问题:
- 用户登录界面不支持注册以及修改密码
- 暂时只能单用户在一台机器上使用(技术盲点)
- 没有写出现输入错误的结果,就是很傻瓜式的系统(大家有兴趣可以加入条件进行修改)
|