我正在为类进行赋值,并且在编译此代码时遇到问题。我在主.cpp文件和类.cpp文件中都使用了#include <string>
。错误是''strcmp'不是'std''的成员,但我知道它是否使用std :: strcmp()或strcmp()。C++在私有成员数据类中使用strcmp()
对我在做什么有什么想法吗?
double temporary::manipulate()
{
if(!std::strcmp(description, "rectangle"))
{
cout << "Strings compare the same." << endl;
return first * second;
}
return -1;
}
@DavidPetersonHarvey见我的编辑。去寻找习惯解决方案! – juanchopanza
对不起冗余,试图找出在哪里添加评论和打错地方。然而,这是可喜的进展,但现在我得到错误:无法将'std :: string {aka std :: basic_string}'转换为'const char *'将参数'1'转换为int int strcmp(const char *,const char *)' 欢迎任何进一步的想法! –
谢谢!我过于复杂的事情。非常尊重! –