【发布时间】:2016-03-02 03:48:23
【问题描述】:
您好,我需要一些代码方面的帮助。我需要测试一个函数,但每次尝试编译时都会出现编译器错误。这是我得到的,错误:不同指针类型'void()()'和'const char'之间的比较缺少强制转换。 这是我的代码。
#include <iostream>
using namespace std;
void getInput();
bool gameGoing = true;
int main()
{
do{
cout << "hello world this is a test.\n";
getInput();
if(getInput == "false")
{
return 0;
}
}while(gameGoing = true);
}
void getInput()
{
string userInput;
cin >> userInput;
}
【问题讨论】:
-
完全不清楚你想要实现什么。您的函数没有返回值,并且您正在尝试将函数指针与字符串进行比较
标签: c++ function compiler-errors