这是代码
#include <iostream>
#include <string>
#include "char.h"
#include "user.h"
bool user::readYN (string ans)
{
ans = tolower (ans);
if (ans == "y" || ans == "yes")
{
return true;
}
else if (ans == "n" || ans == "no")
{
return false;
}
else
{
std::cout<<playr.inputErr;
return false;
}
}
user.cpp:6: parse error before '{'
user.cpp:8: parse error before '+'
#ifndef user
#define user
#include<string>
class user
{
public:
string input;
static string inputErr;
bool readYN(string);
void read(string);
}playr;
#endif
#ifndef chara
#define chara
#include<string>
class charecter
{
public:
string name;
bool yes;
int HP;
void nameMe(string);
}chara;
#endif
最佳答案
改变
bool user::readYN (string ans)
bool user::readYN (std::string ans)
关于c++ - '' *2之前的解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32083700/