求指出代码哪里出错了

P1055 [NOIP2008 普及组] ISBN 号码

Fishcake_pgm @ 2024-11-23 17:34:52

谢谢!

#include<iostream>
using namespace std;
int main(){
    string isbn ;
    int helper = 0;
    int helper2 = 0;
    int helper3 = 0;
    cin>>isbn; //一个isbn总共有13个字符,去掉末尾数字有12个字符,去掉末尾数字有9个数字.
//    cout<<isbn<<endl;
    for (int i = 0; i< 11; i++){
        if (isbn[i] != '-'){
//            cout<<"The number "<<isbn[i]<<" is valid"<<endl;
            helper += 1;
            helper2 += (isbn[i] -'0')*helper ;
        }
    }
    helper3 = helper2 % 11;
    if (isbn[12] == '0' + helper3){
        cout<<"Right"<<endl;
    }else if(helper2 == 10){
        isbn[12] = 'X';
        cout<<isbn<<endl;
    }else{
        isbn[12] = '0' + helper2;
        cout<<isbn<<endl;
    }

}

by Fishcake_pgm @ 2024-11-23 17:41:12

我应该知道哪里错了qwq


|