PTA "Write this number."

the using the System;
 the using the System.Collections;
 the using the System.Collections.Generic;
 the using the System.Linq;
 the using the System.Text;
 the using System.Threading.Tasks; 

namespace ConsoleApp5 
{ 
    class Program 
    { 
         int the Main ( String [] args) 
        { 
            // definition of a large array of receiving digital input 
            char [] = CH new new  char [ 100 ];
             String STR;
             int SUM = 0 ;
             //Define an array used to store a digital number after you enter the number of the bits of the addition 
            int [] = SUM0 new new  int [ 999 ];
             int i = 0 ;
             // A later used to record the value of i 
            int A = 0 ;
             // digital input is accepted and converted into CH array [] in 
            STR = Console.ReadLine (); 
            CH = str.ToCharArray ();
             // a corresponding phonetic string type is stored in the array 
            string [] = str1 new new  String [ 10 ] { " Yi " , " ER " , "San " , " Si " , " Wu " , " Liu " , " Qi " , " BA " , " JIU " , " Shi " };
             // end of the input string automatically adds a '\ 0', so this as the end of the flag is determined 
            for (I = 0 ; STR [I] =! ' \ 0 ' ; I ++ ) 
            { 

                SUM + STR = [I] - ' 0 ' ;
                //This step is not added after the last bad cycle i + 1 then proceeds to decision str [i] index out of bounds
                 // All i plus 1 advance not to break when the last of the 
                IF (i == str.length - 1 ) 
                { 
                    BREAK ; 
                } 
            } 
            // the i is initialized to 
            i = 0 ;
             // the input digital numbers then seek you add up their respective bits
             // note which is located in a reverse SUM0 [] array of 
            the while (SUM =! 0 ) 
            { 
                SUM0 [I] = SUM% 10 ; 
                SUM = SUM / 10 ; 
                I ++ ;
            } 
            // The last step of i is incremented 1, the array index starts from 0, for all i subtract 1
             // such a sum is 123, there are three bits, i.e. i 3 3 cycles 0 array, however, 1,2 enough 
            i-- ;
             // record the value of i is output from the start in the following i, because the sum of the recording array in reverse order 
            a = i;
             for ( int J = 0 ; J <= a; J ++, i-- ) 
            { 
                // str1 array index starts from 0 so (SUM0 [I]) -. 1] 
                Console.Write (str1 [(SUM0 [I]) - . 1 ]);
                 // last number without "" 
                IF (! J = A) 
                { 
                    Console.Write ( "  " );
                }
            }
            return 0;

        }
     }
}

 

Guess you like

Origin www.cnblogs.com/jcahsy/p/11961727.html