A simple programm that reads strings, and responds using a switch;
in this do-while loop containing a switch, I am able to run case 1-4 with no issues, but once i hit the default case, the programme simply loops the default case over and over again the code is as follows;
    do {    switch ( switchstring (entry, input) )
/*the switchstring function is one 1 wrote to convert a given entry(string), 
into an input(integer)*/   
    {
    case 1:
        //code
        repeat = 2;
        break;
    case 2:
        //code
        repeat = 2;
        break;
    case 3:
        //code
        repeat = 2;
        break;
    case 4:
        //code
        repeat = 2;
        break;
    default:
        //code
        repeat = 1;
        break;}} while(repeat == 1);
the 2nd question is regarding my switchstring() function; is there a way to change the switch function such that it reads;
    case (insert string):
i.e. so that I can remove the entire switchstring() function
thanks in advance!
                        
Show us how
switchstring (entry, input)works.The problem you are facing is because, in
defaultyou do the following:Which makes
while(repeat == 1)alwaystrue. And thenswitchstring (entry, input)always return something that makes yourswitchblock always go the thedefault caseagain.