How would I loop a switch statement until one of the valid options are entered.

would this work?
example:

// lets just say all the necessary starting code is already here....

       int choice, number;
do
{
       cout<<"please enter a number from 1-3\n";
       cin>>number;
       switch(number)
       {
             case 1:
               break;
           blah blah blah
}
while(number != 1 || number != 2 || number != 3 );
return 0;
}

Sorry if I confused someone with this I just need some help with looping a switch statement.

You should probably use a while statement with a flag variable and a few if's.

while(Requirmet not met)
{

    cout << "Enter info";
    cin >> info;

    if(  )
        {
         ////do stuff
          Req met;
         }

etc...


}

How would I loop a switch statement until one of the valid options are entered.

would this work?

It will work fine if you set up the while condition correctly. Your condition is always TRUE.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.