在编译器可以运行,在这不知道为啥通不过???
查看原帖
在编译器可以运行,在这不知道为啥通不过???
470881
郭亮20510507027楼主2021/10/23 11:09
#include <stdio.h>

int main()
{
	int i,t,sum=0,n;
	char isbn[14];
	gets(isbn);
	for(i=0;i<12;i++)//i=0~11,即不包括最后一位识别码 
	{
		if(isbn[i]>='0'&&isbn[i]<='9')
		{
			n++;
			t=isbn[i]-48;//字符型数字转换成整型数字 
			sum=sum+t*n;//按题目方法进行求和 
		}
	}
	t=isbn[12]-48;//将识别码转换成整型 
	if(sum%11==t)//检查识别码是否正确 
	printf("Right");
	else
	{
		isbn[12]=sum%11+48;//如果不正确,则改正 
		puts(isbn);
	}
}
## 这是错误信息
/tmp/compiler_jxoqze18/src: 在函数‘main’中:
/tmp/compiler_jxoqze18/src:7:2: 警告:‘gets’ is deprecated [-Wdeprecated-declarations]
  gets(isbn);
  ^~~~
In file included from /tmp/compiler_jxoqze18/src:1:
/usr/include/stdio.h:583:14: 附注:在此声明
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/compiler_jxoqze18/src:24:2: 错误:expected declaration or statement at end of input
  }
  ^
2021/10/23 11:09
加载中...