主题:最近糊涂了,请各位大侠指点一下代码中的红色字体
#include <stdio.h>
#define true 1
#define false 0
int main(void)
{
bool digit_seen[10] = {false};
int digit;
long n;
printf("Enter a number: ");
scanf("%ld", &n);
[color=FF0000]while (n > 0)
{
digit = n % 10;
if (digit_seen[digit])
break;
digit_seen[digit] = true;
n /= 10;
}[/color] if (n > 0)
printf("Repeated digit\n");
else
printf("No repeated digit\n");
return 0;
}
#define true 1
#define false 0
int main(void)
{
bool digit_seen[10] = {false};
int digit;
long n;
printf("Enter a number: ");
scanf("%ld", &n);
[color=FF0000]while (n > 0)
{
digit = n % 10;
if (digit_seen[digit])
break;
digit_seen[digit] = true;
n /= 10;
}[/color] if (n > 0)
printf("Repeated digit\n");
else
printf("No repeated digit\n");
return 0;
}