Function BrSlovima(Broj) As String '****************************************** 'Ime: BrSlovima Function 'Sadržaj: ispisuje broj tekstom 'Autor: ZXZ 'Datum: 08 16, 2009, 12:34:16 'Adresa: Tuzla BiH 'Email: izonic@inet.ba 'Ulazni parametri:broj 'Izlazni parametri:broj ispisan tekstom '***************************************** Dim I1 As Integer, I2 As Integer Dim N1 As Integer, N2 As Integer Dim DioTri As String Dim MjestoTri As Integer Dim RodJ As Integer Dim Strb As String Dim Cifra As Integer Dim Str(1 To 2) As String 'Broj = 112 N1 = Fix(Len(Format$(Broj)) / 3) If Len(Format$(Broj)) Mod 3 > 0 Then N1 = N1 + 1 End If For I1 = 1 To N1 If I1 = 3 Then RodJ = 1 Else RodJ = 2 End If If I1 = N1 Then MjestoTri = 1 N2 = Len(Format$(Broj)) Mod 3 If N2 = 0 Then: N2 = 3 Else N2 = 3 MjestoTri = Len(Format$(Broj)) - I1 * 3 + 1 End If DioTri = Mid(Format$(Broj), MjestoTri, N2) For I2 = 1 To N2 Cifra = Mid(DioTri, N2 - I2 + 1, 1) If Cifra = 1 And Strb = "etiri" Then Strb = "etr" End If If Cifra = 1 And Strb = "šest" Then Strb = "šes" End If Str(1) = Cifre(Cifra, I2, I1) If Str(1) = "naest" And Str(2) = "jedan" Then Str(1) = "aest" End If If Str(1) = "nula" Then GoTo Petlja If Cifra = 1 And I2 = 2 Then If Str(2) = "nula" Then Str(1) = "deset" Strb = Strb & Str(1) Else Strb = Str(1) & Strb End If Petlja: Str(2) = Str(1) Next I2 BrSlovima = Strb & ImenaB(DioTri, RodJ, I1) & BrSlovima Strb = "" Next I1 End Function Function Cifre(Cifra As Integer, PoRedu As Integer, Rod As Integer) As String Select Case Cifra Case 0 Cifre = "nula" GoTo Kraj Case 1 If PoRedu = 1 Then If Rod = 1 Or Rod = 3 Or Rod = 5 Then Cifre = "jedan" Else Cifre = "jedna" End If ElseIf PoRedu = 2 Then Cifre = "jeda" End If Case 2 If PoRedu = 1 Or PoRedu = 3 Then If Rod = 1 Or Rod = 3 Or Rod = 5 Then Cifre = "dva" Else Cifre = "dvije" End If ElseIf PoRedu = 2 Then Cifre = "dva" End If Case 3 Cifre = "tri" Case 4 If PoRedu = 1 Or PoRedu = 3 Then Cifre = "etiri" Else Cifre = "etr" End If Case 5 If PoRedu = 2 Then Cifre = "pe" Else Cifre = "pet" End If Case 6 If PoRedu = 2 Then Cifre = "šez" Else Cifre = "šest" End If Case 7 Cifre = "sedam" Case 8 Cifre = "osam" Case 9 If PoRedu = 2 Then Cifre = "deve" Else Cifre = "devet" End If End Select If PoRedu = 2 Then If Cifra = 1 Then Cifre = "naest" Else Cifre = Cifre & "deset" End If ElseIf PoRedu = 3 Then If Cifra = 2 Or Cifra = 3 Or Cifra = 4 Then Cifre = Cifre & "stotine" ElseIf Cifra = 1 Then Cifre = "stotinu" ElseIf Cifra = 0 Then Else Cifre = Cifre & "stotina" End If End If Kraj: End Function Function ImenaB(StrBr As String, Rod As Integer, PoRedu) As String Dim Cifra As Integer Dim Druga As Integer If Val(StrBr) = 0 Then GoTo Kraj Cifra = Val(Right(StrBr, 1)) If Len(StrBr) > 1 Then Druga = Val(Mid(StrBr, Len(StrBr) - 1, 1)) End If Select Case PoRedu Case 1 'ništa Case 2 If Cifra = 2 Or Cifra = 3 Or Cifra = 4 Then If Druga = 1 Then ImenaB = "hiljada" Else ImenaB = "hiljade" End If Else ImenaB = "hiljada" End If Case 3 If Cifra = 1 Then If Druga = 1 Then ImenaB = "miliona" Else ImenaB = "milion" End If Else ImenaB = "miliona" End If Case 4 If Cifra = 2 Or Cifra = 3 Or Cifra = 4 Then If Druga = 1 Then ImenaB = "milijardi" Else ImenaB = "milijarde" End If ElseIf Cifra = 1 Then If Druga = 1 Then ImenaB = "milijardi" Else ImenaB = "milijarda" End If Else ImenaB = "milijardi" End If Case 5 End Select Kraj: End Function '*--------------------------------------broj slovima kraj-------------------------------------------------