Please help me debug this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
17th May 2022, 11:18 AM
Football Minds7
4 Answers
+ 2
Have another look at if-statements: if is if(age<20) not if(age<20); There mustn't be ; after the condition
17th May 2022, 11:35 AM
Lisa
Lisa - avatar
+ 1
Ok thanks guys 🙏
17th May 2022, 12:06 PM
Football Minds7
0
[TO MAKE IT REPEAT THE INPUT PROCESS] I would suggest you to put a "checkpoint" between the first cout and the cin (something like "start:" or "point:" or whatever you want to name it), then put "goto start;" (your choosen name) in the else statement. Long story short: checkpointname: //your code goto checkpointname; //inside your else statement It is OK for this code, however I suggest to avoid goto statements when not necessary (because of eventual issues with objects initialization and values stored in variables to reset)
17th May 2022, 11:38 AM
OrHy3
OrHy3 - avatar
0
For the if statement, I fully agree with Lisa
17th May 2022, 11:40 AM
OrHy3
OrHy3 - avatar