AI SAMPLE遇到了麻烦 [英] I got troubles with AI SAMPLE

查看:111
本文介绍了AI SAMPLE遇到了麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮帮我。我是c +的新手,我正在尝试建立一个简单的AI程序。

这是我的代码如下。我正在使用Dev c ++运行它,我得到了这个[错误]预期不合格的id。



有人可以帮忙吗?



我尝试过:



Help me. I'm kinda new with c++ and I'm trying to build a simple AI program.
This is my code below. I am running it with Dev c++ and I got this [Error] expected unqualified-id before else.

can someone help?

What I have tried:

#include <iostream>
#include <cstring>

using namespace std;

int main()
{
  char str[50];
  here:cin>>str;
  
  if(strcasecmp ("hello",str)==0)
  cout<< "Doing good?";
goto here;
}

 else if(!strcasecmp ("hi",str)){
 {
cout<<"hey there what's your name"<<end1;
goto here;
return 0;

推荐答案

发布的代码缺少一个开放的大括号 {



the posted code is missing a open curly bracket {

if(strcasecmp ("hello",str)==0) {
    cout<< "Doing good?";
    goto here;
 }


你真的 SHOULDNT 使用goto命令,因为它是不推荐使用的样式。



所以删除语句并在这个地方写下需要代码或函数调用。
You really SHOULDNT use the goto command, because it is deprecated style.

So remove the statement and write the need code or a function call at this place.


这篇关于AI SAMPLE遇到了麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆