Loop structure while do...while loop & program debugging

while loop

Features: First judge the loop condition, and then judge whether the loop body is looping according to the condition.
while (loop condition) { loop operation }


Insert picture description here

do...while loop

Features: execute first and then judge. First execute the loop body and then judge whether the loop condition is satisfied according to the value of the variable. It must be executed at least once.
do{ loop operation }while (loop condition);


Insert picture description here

to sum up

Insert picture description here

Program debugging

Finding program errors through code reading or adding output statements
When the program structure becomes more and more complex, special techniques are needed to find and locate errors, which is the "program debugging"
Insert picture description here
debugging step.
Step 1: Analyze errors and set breakpoints.
Step 2: Start debugging
Step 3: Single-step operation After
debugging is started, the line of code that runs to the set breakpoint will stop.
Press F6 to run the program in a single step and observe the running process of the program.
Step 4: Observe the variable in
single-step operation and you can view it in the "Variable" view Go to the current value of the variable
Step 5: Find the problem

to sum up

Insert picture description here

Guess you like

Origin blog.csdn.net/Yoona_1/article/details/112762770