I have a segment of code that i do not want the program to execute unless the user wants it to and the goto statement brings them there. So id there any function i can nest the segment in to prevent itd execution unless requested to do so.
#include <iostream>
void function()
{
std::cout << "You entered the number to run your segment of code...\n";
}
int main ()
{
int number = 0;
std::cout << "Please enter a number: ";
std::cin >> number;
if( number == 0 )
function();
else
std::cout << "Wrong number, bye...\n";
return 0;
}