C++有關ID生產器的輸出問題(急20點)(程式碼)

using namespace std; int a; a=0; int main();{ randomize(); while(a=0){ int n1[]={10,11,12,13,14,15,16,17,34,18,19,20,21,22,35,23,24,25,26,27,28,29,32,30,31,33}; int idstr[10]; int total=0; int cn=random(26); idstr[0]=n1[cn]; idstr[1]=random(2)+1; for(int... show more using namespace std;
int a;
a=0;
int main();{
randomize();
while(a=0){
int n1[]={10,11,12,13,14,15,16,17,34,18,19,2...
int idstr[10];
int total=0;
int cn=random(26);
idstr[0]=n1[cn];
idstr[1]=random(2)+1;
for(int i=2;i<10;i++)
idstr[i]=random(10);
total=idstr[0]/10+(idstr[0]%10)*9;
for(int k=1;k<9;k++)
total += (idstr[k])*(9-k);
int checkNum = (10 - total % 10) % 10;
if(checkNum == (idstr[9])){
cout<<char(cn+65);
for(int j=1;j<10;j++)
cout<<idstr[j];
return;
}
}
}
2 answers 2