首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >CodeBloks C++错误:未在作用域中声明

CodeBloks C++错误:未在作用域中声明
EN

Stack Overflow用户
提问于 2014-11-21 00:47:04
回答 4查看 4.2K关注 0票数 1

嘿,伙计们,我正在努力学习C++,在我撞到这堵墙之前,我一直做得很好..

我收到两个错误:错误:没有在这个作用域中声明'enter‘错误:没有在这个作用域中声明'Satisfies’

这是我的档案。为什么会这样呢?

代码语言:javascript
复制
include <iostream>

using namespace std;

int main() {
    while (1){
        char menu;
        cin>>menu;
        switch (menu){
            case 1: Enter(); break;
            case 2: Satisfies(); break;
            case 3: break;
            };
    };
}

int Enter(){
    return 0;
}

int Satisfies(){
    return 0;
}
EN

Stack Overflow用户

发布于 2014-11-21 00:59:26

函数调用需要在函数名后加上(),不管它是否接受任何参数。另外,你需要在main()之前定义函数头

代码语言:javascript
复制
include <iostream>
using namespace std;
int Enter();
int Satisfies();

int main() {
    while (1){
        char menu;
        cin>>menu;
        switch (menu){
            case 1: Enter(); 
                break;
            case 2: Satisfies(); 
                break;
            case 3: 
                break;
        };
    };
}

int Enter(){
    return 0;
}

int Satisfies(){
    return 0;
}
票数 0
EN
查看全部 4 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27045036

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档