Can anyone help me with this "bull and cows"


can anyone help me with this i try making bulls and cows with else if instead of using nested if m kinda facing problems everytime when i compile it and tryna play its always showing the first decrement and then start all over again instead of reducing lives 5 times

I’m not an expert but I will try to help
I think you shouldn’t put EndGame(); under PrintLine(TEXT(“sorry try again you have %i lives remaining”), Lives);
maybe you need to put return;
to have more understanding about what you are doing tell me the number of video you are coding this

I’m not quite clear on the output you are getting and expecting. Would you mind posting examples?

P.S. please your indentation it’s currently really hard to read


i have finally sloved it but it looks kinda different from what i saw on the clip now i am thinking if i have been used nested if instead of else if it would be less messier.

1 Like


i was getting only first decrement i mean on a wrong ans lives getting decreased but only one time after that it clears the screen and start the game all over again instead of asking me 5 times so i tried this and its working now i am getting the same result tho it looks kinda messy.

That’s great news nice

Could you give screenshots of that output?

Also please watch the lecture titled “Indentation” and follow through it. It is not clear from your screenshots of which part of code belongs to which scope. You shouldn’t need to carefully look at code to understand that information, it should be easily understand that without really thinking about it.

Privacy & Terms