代码求助
请各位大神帮忙写一下代码注释#include<stdio.h>
#include<math.h>
void judge() {
int num;
int prev = -1;
int prev_prev = -1;
int prev_prev_prev = -1;
char c;
int bad = 0;
while ((c = getc(stdin)) != '\n') {
ungetc(c, stdin);
scanf("%d", &num);
if (bad) {
continue;
}
if (prev_prev_prev == -1) {
prev_prev_prev = prev_prev;
prev_prev = prev;
prev = num;
continue;
}
if (prev_prev_prev / 10 != num / 10) {
if (!(prev_prev_prev / 10 == prev / 10 && num / 10 == prev_prev / 10)) {
printf("false");
prev_prev_prev = prev_prev;
prev_prev = prev;
prev = num;
bad = 1;
continue;
}
}
prev_prev_prev = prev_prev;
prev_prev = prev;
prev = num;
}
printf("true");
}
int main() {
int num;
char c;
while ((c = fgetc(stdin)) != EOF) {
ungetc(c, stdin);
judge();
}
} 你是想用这代码干什么?这代码有很多毛病。。。
页:
[1]