When I write a program using int main() has worked well for my needs. As my program grows though - I want to move to other areas of the program. How would I do this
1 2 3 4 5 6 7 8 9 10
int main() {
std::cout << "blah";
//If a condition is met jump to secondary.
return main();
}
Int secondary ()
{
Std::Cout << "hola"
/*Stay in this function until condition met then return to main()*/
#include <iostream>
int secondary(); // <---Function prototype
int main()
{
std::cout << "blah";
//If a condition is met jump to secondary.
if (condition is true)
{
secondary(); // <--- Function call
}
return 0;
}
int secondary() // <--- Lowercase i.
{
std::cout << "\nhola"; // <--- Lowercase letters. Missing ;
/*Stay in this function until condition met then return to main()*/
returnint;
}