代码如下,有问题hi我
#include
using namespace std;
void main()
{
char szNum[15]={0};
int n,curn,pren=-1;
int count=1,total;
int pos=0,i,j;
bool flag=false;
cin>>total;
for(i=0;i
cin>>n;
if(n==0)
{
cout<<0<
}
flag=false;
while(n>0)
{
curn=n%10;
if(curn==0&&!flag) {n/=10;count++;continue;}
else if(curn==0&&pren==0) {n/=10;count++;continue;}
else if(curn==0) {szNum[pos++]='0';n/=10;pren=curn;count++;continue;}
flag=true;
char sign;
switch(count)
{
case 2:sign='S';break;
case 3:sign='B';break;
case 4:sign='Q';break;
case 5:sign='W';break;
}
if(count>1) szNum[pos++]=sign;
szNum[pos++]=curn+'0';
pren=curn;
n/=10;
count++;
}
for(j=14;j>=0;j--)
{
if(szNum[j]!='\0') printf("%c",szNum[j]);
szNum[j]='\0';
}
printf("\n");
count=1;
pren=-1;
pos=0;
}
}
void main()
{
unsigned int i=0;
unsigned int d[200];
unsigned int n;
unsigned int div[5] = {1, 10, 100, 1000, 10000};
char c[5] = {' ','S', 'B', 'Q', 'W'};
unsigned int start, tmp = 1;
scanf("%u", &n);
for(i = 0; i
scanf("%u", &(d[i]));
if(d>=100000)
{
i--;
continue;
}
}
for(i=0;i
start = 0;
for(j=4;j>=0;j--)
{
if(start==0)
{
if(d[i]/div[j]==0)
{
continue;
}
else
{
start = 1;
}
}
if(d[i]/div[j])
{
printf("%d%c", d[i]/div[j], c[j]);
}
else
{
if(tmp!=0)
{
printf("0");
}
}
}
if(start==0)
printf("0");
printf("\n");
}
}