初夏浅梦i
2020-06-03 18:58
采纳率: 100%
浏览 122

大佬请问一下 为什么在main中调用这个功能就崩溃了 求解

void Pt::addoneorder()
{
string farexz, farename, bourn, phone, orderxz;
time_t now = time(0);
char* localtime = ctime(&now); // 获取时间
while (1)
{
cout << "请你输入你的姓名:";
cin >> farename;
cout << "请你输入你的目的地:";
cin >> bourn;
cout << "请你输入你的手机号:";
cin >> phone;
cout << "你确定提交该订单吗?是/否";
cin >> orderxz;
if (orderxz == "是" || orderxz == "Y" || orderxz == "y")
{
string localtimenow = localtime;
int idbh = 623500 + len + 1;
orders[len].id = idbh;
orders[len].kehu = farename;
orders[len].diver = "暂未接单";
orders[len].cjsj = localtimenow;
orders[len].ztai = "否";
orders[len].sjh = phone;
orders[len].slsj = "暂未受理";
cout << "提交成功,你的订单号为:" << idbh << "正在等待司机的受理,可在用户模块查看已发布订单查询!" << endl;
break;
}
else if (orderxz == "否" || orderxz == "N" || orderxz == "n")
{
cout << "订单已取消!" << endl;
cout << "请问是输入输入错误,需要重新输入还是返回上一级,请选择以下操作:" << endl;
cout << "-------------------------------------------------------------------------------------" << endl;
cout << "1、重新输入、2、返回上一级" << endl;
cout << "-------------------------------------------------------------------------------------" << endl;
cout << "请输入你的选择:";
cin >> farexz;
if (farexz == "1" || farexz == "重新输入")
{
continue;
}
else if (farexz == "2" || farexz == "返回上一级")
{
break;
}
else
{
cout << "输入错误,请你检查后重新输入!" << endl;
}
}
else
{
cout << "输入错误,请你检查后重新输入!" << endl;
continue;
}
}
}


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题