#include<stdio.h>
int main()
{
int line=0;
int at_beginning=1;
char ch;
signed char checksum= -1;
while((ch = getchar()) != EOF)
{
if(at_beginning == 1)
{
line += 1;
at_beginning = 0;
printf("%d ",line);
}
checksum += ch;
putchar(ch);
if(ch == '\n')
{
at_beginning = 1;
printf("checksum=%d\n",checksum);
}
}
return 0;
}
读取字符并校验和
最新推荐文章于 2024-01-14 12:55:18 发布