I can tell you how the switch works. Its prototype looks like this
1 2 3 4 5 6
|
function(condition){
case constant: //statements to execute
case constant:
case constant: //statements to execute
}
|
Its really mainly used to decide from a big selection of options such as a menu or different paths but if we look at an if statement its the same as:
1 2 3 4 5 6
|
if(opselect == 0){
//insert statements to do if true
break;
if(opselect==1){
//insert statements to do if true
}};
|
Just a nested IF.
Switchs just skip what doesnt match the criteria you gave until it finds a match and then executes. Same as a nested if, in this case if i select one then it will skip the first if and execute the next. The more options the more if's you need. Which is why switch is an option in some cases.
Dont use switches outside of menu options, not good for logic. IF's for logic, skip the switch. Switch for menu options, skip the if.
I cant answer your other question but hopefully this helps
I would remove the IF's and re-write your code to match the prototype. such as instead of what you have:
1 2 3
|
switch(opselect){
case1: cout<<"Welcome to the edit booking menu!"<<endl;
}
|
and so on.
EDIT: A suggestion about your second question, maybe put it all in a function before the switch or with the switch. That way if you ever want to avert back to the menu you can just call the function. Just a thought.