Z5 infa, studia calosc, infa cwiczenia

Poza tym na świecie jest niewiele istot groźniejszych od kobiety.

5.1

Sub nowe_gieszczyk_paweł()

Dim etat As String

 

For i = 1 To 7

    etat = Cells(1 + i, 1).Value

 

If etat = "sprzedawca" Then

    Cells(1 + i, 3).Value = 8

    End If

   

If etat = "kierownik" Then

    Cells(1 + i, 3).Value = 15

    End If

  

If etat = "asystent" Then

    Cells(1 + i, 3).Value = 10

    End If    

Next i

End Sub

 

5.2

A)

Sub gieszczyk()

Dim etat As String

Dim i As Integer

For i = 1 To 10

    Cells(1, i).Value = i

Next i

End Sub

 

B)

Sub gieszczyk()

 

Dim etat As String

Dim i As Integer

Dim a As Integer

For i = 1 To 10

    Cells(1, i).Value = i

    Cells(2, i).Value = Sqr(i)

Next i

End Sub

 

 


 

5.4

Option Explicit

Private Sub cmdKwadrat_Click()

Dim x As Byte

Dim a, b, c, d, x1, x2 As String

x = MsgBox("Do komórek C5 C6 C7 wprowadź odpowiednio a b c")

a = Cells(5, 3).Value

b = Cells(6, 3).Value

c = Cells(7, 3).Value

d = b ^ 2 - 4 * a * c

If d >= 0 Then

x1 = (-b - Sqr(d)) / (2 * a)

x2 = (-b + Sqr(d)) / (2 * a)

Cells(5, 5).Value = ("x1=" & Str(x1))

Cells(6, 5).Value = ("x2=" & Str(x2))

Else

Cells(7, 5).Value = ("brak pierwiastków")

End If

End

End Sub

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • kachorra.htw.pl