错误:
所有这些错误都可以在这一行找到:
//ClassPractice.cpp
void tellStats(pick);
Run Code Online (Sandbox Code Playgroud)
哪个叫......
//Functions.h
void tellStats(string);
Run Code Online (Sandbox Code Playgroud)
这被定义为......
//Functions.cpp
void tellStats(string choice)
{
if (choice == "wizard")
{
cout << "These are the Wizard's stats:" << endl;
cout << "Max HP: 80\nSpeed: 7\nAttack: 10" << endl;
}
}
Run Code Online (Sandbox Code Playgroud)
我不明白为什么我会收到这些错误.我不知道为什么int甚至涉及错误.在这些代码部分中,我没有看到任何涉及int的内容.我以为我正确使用'void'因为我不想用函数返回值.
你不要用返回类型调用函数.不要说:
void tellStats(pick);
Run Code Online (Sandbox Code Playgroud)
只是用tellStats(pick);.
那条线路是你调用tellStats的唯一地方吗?