嘿,伙计们,我正在努力学习C++,在我撞到这堵墙之前,我一直做得很好..
我收到两个错误:错误:没有在这个作用域中声明'enter‘错误:没有在这个作用域中声明'Satisfies’
这是我的档案。为什么会这样呢?
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;
}发布于 2014-11-21 00:59:26
函数调用需要在函数名后加上(),不管它是否接受任何参数。另外,你需要在main()之前定义函数头
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;
}https://stackoverflow.com/questions/27045036
复制相似问题