#3098: 不知哪裡錯了


windnebula (小宇)


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int x=0,i,t;
    char a[10][4]={"零","壹","貳","參","肆","伍","陸","柒","捌","玖"};                  
    char b[4][4]={"","拾","佰","仟"};
    int c[10]={0};

    while(cin>>x)
    {
     if(x==0)cout<<a[0];
     for(i=0;i>=0;i++)
     {
      c[i]=x%10;
      x=int(x/10);
      if (x=0)break;
     }
     for(t=10;t>0;t--)
     {
      if(c[t]==0)cout<<"";
      else if(t=10)
                   {
                    if(c[t]==0)cout<<"";
                    else cout<<a[c[9]]<<b[1];
                   }
      else if(t=9)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[8]]<<"億";
                  }
      else if(t=8)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[7]]<<b[3];
                  }
      else if(t=7)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[6]]<<b[2];
                  }
      else if(t=6)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[5]]<<b[1];
                  }       
      else if(t=5)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[4]]<<"萬";
                  }   
      else if(t=4)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[3]]<<b[3];
                  }
      else if(t=3)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[2]]<<b[2];
                  }    
      else if(t=2)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[1]]<<b[1];
                  }   
      else if(t=1)
                  {
                   if(c[t]==0)cout<<"";
                   else cout<<a[c[0]]; 
                  }                     
     }
    
    }
    system("PAUSE");
    return EXIT_SUCCESS;
}
可以幫我看看嗎?

#3679: Re:不知哪裡錯了


meuame (渺雨)


我只稍微看一下,發現很多==都打成=啊。