Other ways to transfer control to another place in your program without using goto:
- loops (for, while, do/while)
- break
- continue
- return
- switch
One simple way to solve this is just to have repetitive code in main. Obviously if the repetition is beyond about twice a function is better, but maybe that's what your lecturer is trying to demonstrate.
eg instead of adding up number pairs.
my lecturer forbid me from using function and goto
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int main()
{
int a = 0 //etc as needed;
cin >> a;
cin >> b;
cout << a+b;
//then
cin >> c;
cin >> d;
cout << c+d;
// a function becomes a worthwhile consideration if there is no restriction?
// if's etc for branching (with difficulty?)
}