Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/133.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何使一个void函数与C++;?_C++ - Fatal编程技术网

C++ 如何使一个void函数与C++;?

C++ 如何使一个void函数与C++;?,c++,C++,我把'(RE)放在void F()中,但我的程序遇到了一个有趣的问题。当我把(RE)放在我的voidF()中时,我的void RE()是在void F()上面编码的,那么void RE()如何才能知道void F()?Visual Studio不允许我以这种方式运行程序。我认为它们在main()之外被声明为void函数,所以我认为它们在任何地方都可以工作 . . . . . void F() { if (nextChar() == 'a') match('a');

我把
'(RE)
放在
void F()
中,但我的程序遇到了一个有趣的问题。当我把
(RE)
放在我的void
F()
中时,我的
void RE()
是在
void F()
上面编码的,那么
void RE()
如何才能知道
void F()
?Visual Studio不允许我以这种方式运行程序。我认为它们在
main()
之外被声明为void函数,所以我认为它们在任何地方都可以工作

.
.
.
.
.
void F()
{
    if (nextChar() == 'a')
        match('a');
    else if (nextChar() == 'b')
        match('b');
    else if (nextChar() == 'c')
        match('c');
    else if (nextChar() == 'd')
        match('d');
    else if (nextChar() == 'a')
    {
        match('(');
        RE();      //HOW????
        match(')');
    }
}

void RE()
{
    if (nextChar() == 'a')
    {
        RE();
        RE();
    }
    else if (nextChar() == 'a')
    {
        RE();
        match('|');
        RE();
    }
    else if (nextChar() == 'a')
    {
        RE();
        match('*');
    }
    else if (nextChar() == 'a')
        F();                   //How????
}


int main()

RE()
声明放在
F()
之前:


RE()
声明放在
F()
之前:

函数可以具有和。要能够调用函数,代码所需要的只是能够看到一个声明

因此,为
RE
F
提供声明,然后定义它们

void RE();
void F();

//RE and F definitions here.
函数可以具有和。要能够调用函数,代码所需要的只是能够看到一个声明

因此,为
RE
F
提供声明,然后定义它们

void RE();
void F();

//RE and F definitions here.

哦,上帝。。。。为什么我要费心问这个。。。。我的大脑最近一直在昏睡。非常感谢。哦,上帝。。。。为什么我要费心问这个。。。。我的大脑最近一直在昏睡。非常感谢你。