我通常在DreamInCode.net上发帖,但该网站现在似乎已经关闭了.我是De Anza的第一个学期CS学生.我真的不明白lineCount = 1; 在else语句中.我知道当我删除声明时它会做什么,但我不明白.如果我可以让某人向我解释这可能是因为这本书恰好跳过了,我会非常感激.
#include <stdio.h>
int main (void) {
int num;
int lineCount;
printf ("\nEnter a starting number to decend between 1 and 100: ");
scanf ("%d", &num);
if (num > 100)
num = 100;
lineCount = 0;
while (num >= 0)
{
if (lineCount < 10)
lineCount++;
else
{
printf ("\n");
lineCount = 1; // this line here is what I don't understand
}
printf ("%4d", num--);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)