ISBN码字符串c++

这题充满了玄学问题!!!用cin.getline竟然会报错;而且输出一些不得了的东西。看来有时候还是要用cin了啊!!!

#include
using namespace std;
int n,m,x,s,y;
int main()
{
	char  a[500],b[500];
	cin>>a;
	for(int i=0;i='0'&&a[i]<='9')
		{
		    y++;
		    s++;
		     b[y]=a[i];  
		    
		}
	}
	for(int k=1;k<=s;k++)
	n+=(b[k]-48)*k;
	if(a[strlen(a)-1]=='X') x=10;
	else x=a[strlen(a)-1]-48;	
	m=n%11;
	if(m==x)
	{
	    cout<<"Right";
		return 0;
	}
	else
	{
		for(int j=0;j

  

转载于:https://www.cnblogs.com/5t2y0/p/9239435.html

你可能感兴趣的:(ISBN码字符串c++)