Function Leading to Another Function

I have a program that I'm making and I want to have the completion of one function lead to another function. So once one equation is done, I want for another equation in a different function to be completed. For example, in my program, I did this:

void Function1()
{
int a ;
a = 4 + 2 ; //For example
//now, go to another function, with the value of variable a
//how do I do that, so that the next function executed is Function2
// I did :
goto Function2() ;
}
void Function2()
{
int b ;
b = a - 4 ; // Again, just an example
}

Why doesn'y this work, and, what will?

when I compile it in Code::Blocks, the error message given is:

error: label 'function2' used but not defined

How do I fix this?!

Thank you, any feedback would be appreciated.
closed account (NUj6URfi)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>

using namespace std;

void Function1();
int Function2(int x)

int main() {

Function1();
cout << b;

cin.get();
return 0;
}
void Function1() {
int a;
a = 4 + 2;
Function2(a);
return;
}
int Function2(int x) {
int b;
b = x - 4;
return b;
}
Topic archived. No new replies allowed.