´¹¤åºK

¹q¸£¤­°ê»y¨¥°ò¦1: ½á­È

µ¹´¹·s»D¤@­ÓÆg


§@ªÌ¡G®L»F¼Ý 2010-12-14 ªìª©

¤@¯ë¶Ç²Îªº¹q¸£»y¨¥ BASIC »P C++¡A
ÁöµM¥j¦Ñ¡A¦ý¤@­Ó²³æ¡A¤@­Ó¼sªx¡C
­n©ß±ó¡AÁÙ¯u¦³ÂI§xÃø¡C
¤ñ¸û·s¤@ÂIªº JAVA, C#, PHP¡A°ò¥»¤W¤j¦P¤p²§¡A¤@³q¦Ê³q¡C
¹q¸£»y¨¥ªº²Ä¤@¨B¡A´N¬O'½á­È»y¥y' Assignment Statement¡C
¥¦´N¬O§â¤@­Ó­È¡A¶ë¤J¥t¤@ÅܼƤº¡C
¦p a=1¡A´N¬O§â1 ©ñ¨ìa ¤¤¡C
¤S¦p a=a+1 ³o¤£¬O¸Ñ¤èµ{¦¡¡A
¦Ó¬O§âa+1 ªº­È¦A©ñ¦^ a¡C

¥H¤U´N¬O BASIC,C++, JAVA, C# »P PHP µ¥»y¨¥ªº¥Ü½d¡C
°ò¥»¤º®e´N¬O:

' Value Assignment ¼Æ­È³]©w
iA = 1*2+3/4-5
iB = 1*(2+3)/4-5
iC =iA  Mod  2

' ¦C¦L iA,iB,iC

' String Assignment ¦r¦ê³]©w
sS="abc"

' String Catenation ¦r¦ê³s±µ
sS=sS+"<>"
sS=sS+"def"

' ¦C¦L sS


BASIC:
        ' *******************************************
        '  Assignment Statement BASIC
        ' *******************************************
        Sub AssignmentStatement()
            Dim iA as Integer
            Dim iB as Integer
            Dim iC as Integer
            Dim sS as String
            ' Value Assignment
            iA = 1*2+3/4-5
            iB = 1*(2+3)/4-5
            iC =iA  Mod  2
            Debug.Print " ";iA;
            Debug.Print " ";iB;
            Debug.Print " ";iC;
            Debug.Print
            ' String Assignment
            sS="abc"
            ' String Catenation
            sS=sS+"<>"
            sS=sS+"def"
            Debug.Print " ";"sS=";
            Debug.Print " ";sS;
            Debug.Print
        End Sub

C++:
        /* ******************************************* */
        /* Assignment Statement  C++                                    */
        /* ******************************************* */
        void AssignmentStatement() {
            int iA;
            int iB;
            int iC;
            char* sS;
            /* Value Assignment */
            iA = 1*2+3/4-5;
            iB = 1*(2+3)/4-5;
            iC =iA % 2;
            printf(" %d" , iA);
            printf(" %d" , iB);
            printf(" %d" , iC);
            printf("\n\r" );
            /* char* Assignment */
            vstrcpy((char**)&sS, "abc");
            /* char* Catenation */
            vstrcat((char**)&sS, "<>");
            vstrcat((char**)&sS, "def");
            printf(" %s" , "sS=");
            printf(" %s" , sS);
            printf("\n\r" );
            vfree((char*)sS);
        }

JAVA:
        // *******************************************
        // Assignment Statement JAVA
        // *******************************************
        public void AssignmentStatement()  {
            int iA;
            int iB;
            int iC;
            String sS = null;
            // Value Assignment
            iA = 1*2+3/4-5;
            iB = 1*(2+3)/4-5;
            iC =iA % 2;
            System.out.print(" "+iA );
            System.out.print(" "+iB );
            System.out.print(" "+iC );
            System.out.println("");
            // String Assignment
            sS="abc";
            // String Catenation
            sS=sS+"<>";
            sS=sS+"def";
            System.out.print(" "+"sS=" );
            System.out.print(" "+sS );
            System.out.println("");
        }

C#:
        /* ******************************************* */
        /* Assignment Statement C#                                        */
        /* ******************************************* */
        public void AssignmentStatement()  {
            int iA;
            int iB;
            int iC;
            String sS = null;
            /* Value Assignment */
            iA = 1*2+3/4-5;
            iB = 1*(2+3)/4-5;
            iC =iA % 2;
            Console.Write(" "+iA);
            Console.Write(" "+iB);
            Console.Write(" "+iC);
            Console.WriteLine("");
            /* String Assignment */
            sS="abc";
            /* String Catenation */
            sS=sS+"<>";
            sS=sS+"def";
            Console.Write(" "+"sS=");
            Console.Write(" "+sS);
            Console.WriteLine("");
        }

PHP:
        /* ******************************************* */
        /* Assignment Statement  PHP                                    */
        /* ******************************************* */
        function AssignmentStatement()  {
            /* Value Assignment */
            $iA = 1*2+3/4-5;
            $iB = 1*(2+3)/4-5;
            $iC =$iA % 2;
            echo " ".$iA;
            echo " ".$iB;
            echo " ".$iC;
            echo "";
            /* String Assignment */
            $sS="abc";
            /* String Catenation */
            $sS.="<>";
            $sS.="def";
            echo " "."sS=";
            echo " ".$sS;
            echo "";
        }