c# - How do i continue to the next statement after the while loop is done? -
so have after first while loop corect , continues second one?.. hope u guys can give me hand :) iam beginning c# programmer btw ;p
here code :
bool correctawnser = true; console.writeline("you selected easy mode!" + "\n" + "first riddle.."); while (correctawnser) { console.writeline("the more take, more leave behind. i?"); if (console.readline() == "footsteps") { console.writeline("that correct! 5 points!"); points = easypoints; console.writeline("you have " + points + " points"); correctawnser = false; } else { console.writeline("sorry not correct!"); } } while (correctawnser) { console.writeline("mr.smith has 4 daughters. each of daugthers has brother. how many children mr.smith has?"); if(console.readline() == "5 children") { console.writeline("that correct. gained 5 points!"); points = easypoints + 5; console.writeline("you have total of " + easypoints + " points"); correctawnser = false; } else { console.writeline("sorry not correct!"); } }
set boolean true between loops. because boolean correctawnser set false during first loop, , remains false when second loop. switching true it!
Comments
Post a Comment