Page 44 - ePB316_最佳案例 Visual Basic 2017 程式設計
P. 44

Visual Basic 2017 程式設計




                    ̬eReadLine ˙ج

                        Ϥ˙جٙႧجމ

                        Public Shared Function ReadLine() As String


                    Էνj˸ɨાࠑ̙ᛘ՟Դ͜٫ה፩ɝٙοЕf

                        Dim s As String
                        s = Console.ReadLine( )
                        Console.WriteLine(s)


                    ፩ɝٙ؇Гʔ၍݊ڛזЬᅰοאʕߵ˖dVB ѩൖމοЕd߰፩ɝٙ؇Г݊ᅰ࠽d˲
                    ࠅආБᅰ࠽༶ၑdۆࠅԴ͜ Val Ռᅰᔷމᅰ࠽fԷνj˸ɨાࠑ̙ਗ਼οЕ s ᔷމᅰ࠽
                    Ԩ̋ɓܝ፩̈fVal ٙ̌ঐ݊ਗ਼οЕᔷމᅰ࠽f


                        Dim s As String
                        Dim a As Short
                        s = Console.ReadLine()
                        a = Val(s) + 1
                        Console.WriteLine(a)


                    ߰͊΋Դ͜ Val ՌᅰᔷۨϾٜટ޴̋dۆൖމοЕ޴̋fሗІБᒟɝ˸ɨ೻όdԨᝈ
                    ࿀ੂБഐ؈f

                        Module Module1
                            Sub Main()
                                Dim s1 As String = "12"
                                Dim s2 As String = "34"

                                Dim s As String
                                s = s1 + s2
                                Console.WriteLine(s)
                                Dim a As Short
                                a = Val(s1) + Val(s2)
                                Console.WriteLine(a)
                            End Sub
                        End Module






              36
   39   40   41   42   43   44   45   46   47   48