If you are wanting to basically queue up a bunch of functions to be processed then you can use funciton pointers and an array and iterate through the array. Function pointer arrays are also useful for flow control.
Learn about funciton pointer arrays here.
At the bottom of the funciton pointer array function where he calls the funcitons uysing the array you could easily place this in a for loop. Personally I like to use an STL queue, list, or matrix, depending on what the purpose is.
However, if you do want to edit your own program you have a problem, because once you're program is compiled and you run the EXE, it is no longer in C++, it is in machine code....
Code:
004010CC >/$ 55 PUSH EBP
004010CD |. 8BEC MOV EBP,ESP
004010CF |. 83EC 44 SUB ESP,44
004010D2 |. 56 PUSH ESI
004010D3 |. FF15 74634000 CALL DWORD PTR DS:[<&KERNEL32.GetCommand>; [GetCommandLineA
004010D9 |. 8BF0 MOV ESI,EAX
004010DB |. 8A00 MOV AL,BYTE PTR DS:[EAX]
004010DD |. 3C 22 CMP AL,22
004010DF |. 75 1B JNZ SHORT NOTEPAD.004010FC
004010E1 |> 56 PUSH ESI ; /pCurrentChar
004010E2 |. FF15 FC644000 CALL DWORD PTR DS:[<&USER32.CharNextA>] ; \CharNextA
004010E8 |. 8BF0 MOV ESI,EAX
004010EA |. 8A00 MOV AL,BYTE PTR DS:[EAX]
004010EC |. 84C0 TEST AL,AL
004010EE |. 74 04 JE SHORT NOTEPAD.004010F4
004010F0 |. 3C 22 CMP AL,22
004010F2 |.^75 ED JNZ SHORT NOTEPAD.004010E1
004010F4 |> 803E 22 CMP BYTE PTR DS:[ESI],22
004010F7 |. 75 15 JNZ SHORT NOTEPAD.0040110E
004010F9 |. 46 INC ESI
004010FA |. EB 12 JMP SHORT NOTEPAD.0040110E
004010FC |> 3C 20 CMP AL,20
004010FE |. 76 0E JBE SHORT NOTEPAD.0040110E
00401100 |> 56 PUSH ESI ; /pCurrentChar
That's not all machine code, there's some extra junk there, but you should see that this is nothing like any high level programming language(which is what C++ is). The organization of seperate funcitons disapears, which is what a compiler basically does, what you are wanting to do, but you can't compile you're own program, because it's already compiled!!!! Plus even if you could udnestand the machine code you'd still have to deal with the problem that if you try to edit the file it's going to give you an access violation because the program is running, can't edit the exe file of a running program.
What you could do however, is write a program that opens a cpp file as just a text file, and does as you say, combines functions, and then closes the file. You would then manually compile the cpp with a standard compiler such as Visual Studio C++ and see if it will compile and run. You mentioned trying to make a compiler, that's what a compiler does, is opens something as a text file, interprets the words and symbols, and then saves it in some other language. It does not edit itself though, or try to combine it's own functions.
... Which came first? The compiler, or the source code for the compiler?