为了账号安全,请及时绑定邮箱和手机立即绑定

为毛调试时会闪退??C++

为毛调试时会闪退??C++

C++
Pedro_X983 2016-09-23 20:04:55
#include <iostream>#include <string>using namespace std;int welcome();int welcomeCH();int doit();int usually();string name; int nothing;int main(){ cout << "*******************************************************\n"; cout << "***               (隐藏)                    ***\n"; cout << "***            (隐藏)                  ***\n"; cout << "***            (隐藏)                 ***\n"; cout << "***               (隐藏)                   ***\n"; cout << "*******************************************************\n"; welcome; return 0;}int welcome(){ cout << "==============================================================\n"; cout << "(隐藏):\n"; cout << "(隐藏)        (隐藏)       (隐藏)\n"; cout << "==============================================================\n"; string yuyan; cin >> yuyan; if (nothing == 0) { if (yuyan == "(隐藏)") { welcomeCH; } else cout << "(隐藏)"; } nothing++; return 0;}int welcomeCH(){ cout << "(隐藏)\n"; cin >> name; cout << "(隐藏) " << name << ":"; usually; return 0;}int usually(){ cout << "(隐藏) \n"; cout << "==============================================================\n"; cout << "(隐藏)"; cout << "==============================================================\n"; cout << "(隐藏)"; cout << "==============================================================\n"; cout << "*******************************************************\n"; cout << "***               (隐藏)                    ***\n"; cout << "***            (隐藏)                 ***\n"; cout << "***              (隐藏)                 ***\n"; cout << "***                (隐藏)                    ***\n"; cout << "*******************************************************\n"; string shezhi; cin >> shezhi; if (shezhi == "设置")  {  doit; } if (shezhi == "再见") { cout << "再见\t"; return 0; } return 0;}int doit(){ cout << "==============================================================\n"; cout << "语言:\n"; cout << "==============================================================\n"; string shezhi; cin >> shezhi; if (shezhi == "语言") { cout << "==============================================================\n"; cout << "语言:\n"; cout << "English        简体中文       Français\n"; cout << "==============================================================\n"; string yuyan; cin >> yuyan; if (yuyan == "简体中文") { welcomeCH(); } else cout << "(隐藏)"; usually(); } return 0;}
查看完整描述

2 回答

已采纳
?
onemoo

TA贡献883条经验 获得超454个赞

你检查一下,在很多调用函数的地方,你只写了函数名、少写了()。 这样语句就不是调用函数,并且在编译时编译器应该会给出警告的。


编译时一定要注意编译器给出的所有提示,包括error和warning。 不要以为能编译通过就算写好了,你也应该看看编译器是否提示warning,很多时候警告是有意义的,它意味着你的代码有隐患或者是写错了。   初学时一定要努力做到写出的代码零警告、零错误。

查看完整回答
2 反对 回复 2016-09-23
  • 2 回答
  • 0 关注
  • 1457 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信