Hi All
Can someone pls help me on this one. Under nested 'if' conditions inside 'case', i have 2 sections. If i choose to go to section 1 or 2, when i am done, how can i return back to the primary 'if'. Any help will be highly appreciated.
This is the general structure of my program.
int main()
{
//variables initialized here
int option;
char sectionLoop;
cout << "Statements.........;
cout << "Choose Options. (1,2, 3 or 4)\n"; cin >> option";
do
{
//statements
//statements
}
while ((option <1) || (option >4));
switch (option)
{
case 1:
{
//Statements
//Nested if's
{
if (............) // Option was 1, assign data to multiple variables
//statements
//statements
//statements
cout << "Do you want to proceed to [SECTION A] or [SECTION B] (A/B)? : ";
cin >> sectionLoop;
}
// QUESTION : IF I CHOOSE TO GO TO [SECTION A OR B BELOW,], HOW CAN I RETURN BACK TO PRIMARY NESTED IF UNDER CASE 1?
// [SECTION A]
if ((sectionLoop == "a") || (sectionLoop == "A"))
{
// statements
// statements
// statements
break;
}
// [SECTION B]
else if ((sectionLoop == "b") || (sectionLoop == "B"))
{
// statements
// statements
// statements
// statements
// statements
// statements
break;
case 2:
{
// Similar to case 1)
}
case 3:
{
// Similar to case 1)
}
case 4:
{
// Similar to case 1)
}
}