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

#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;

}


Pedro_X983
浏览 1459回答 2
2回答

onemoo

你检查一下,在很多调用函数的地方,你只写了函数名、少写了()。 这样语句就不是调用函数,并且在编译时编译器应该会给出警告的。编译时一定要注意编译器给出的所有提示,包括error和warning。 不要以为能编译通过就算写好了,你也应该看看编译器是否提示warning,很多时候警告是有意义的,它意味着你的代码有隐患或者是写错了。   初学时一定要努力做到写出的代码零警告、零错误。
打开App,查看更多内容
随时随地看视频慕课网APP