04.06.2008 | 22:12:22
immagine
Ing. Emanuele Scapin

3 BM, a.s. 2011/2012
  • Compiti svolti

    3BM 2011-2012 ITCG "A. Ceccato" Thiene 2011-10-14 Verifica_3BM_20111013.pdf
    3BM 2011-2012 ITCG "A. Ceccato" Thiene 2011-11-12 Verifica_3BM_20111112.pdf
    3BM 2011-2012 ITCG "A. Ceccato" Thiene 2011-12-13 Verifica_3BM_20111213.pdf
    3BM 2011-2012 ITCG "A. Ceccato" Thiene 2012-02-25 Verifica_3BM_20120225.pdf
    3BM 2011-2012 ITCG "A. Ceccato" Thiene 2012-04-27 Verifica_3BM_20120427.pdf

     

  • Esercizio 6 pagina 452

    Public Class Form1
        Dim a() As Integer
        Dim n As Integer
        Private Sub btninput_Click(sender As System.Object, e As System.EventArgs) Handles btninput.Click
            Dim i As Integer
    
            Do
                n = Val(InputBox("Inserire numero valori"))
            Loop Until n < 20
    
            ReDim a(n)
    
            For i = 0 To n - 1
                a(i) = Val(InputBox("Inserire valori"))
            Next
    
        End Sub
    
        Private Sub btnordina_Click(sender As System.Object, e As System.EventArgs) Handles btnordina.Click
            Dim i, app, d As Integer
            For i = 0 To n - 2
                For d = i + 1 To n - 1
                    If a(i) > a(d) Then
                        app = a(i)
                        a(i) = a(d)
                        a(d) = app
                    End If
                Next
            Next
            For i = 0 To n - 1
                txtrisultato.Text = txtrisultato.Text + Str(a(i)) + vbCrLf
            Next
        End Sub
    End Class
    

     

  • Esercizio 7 pagina 452

    Public Class Form1
        Dim a() As String
        Dim n As Integer
    
        Private Sub btninput_Click(sender As System.Object, e As System.EventArgs) Handles btninput.Click
            Dim i As Integer
            n = Val(InputBox("Inserire numero squadre nel camionato"))
            ReDim a(n)
            For i = 0 To n - 1
                a(i) = UCase(InputBox("Inserire in ordine le squadre del campionato"))
            Next
        End Sub
    
        Private Sub btnricerca_Click(sender As System.Object, e As System.EventArgs) Handles btncerca.Click
            Dim i As Integer
            Dim t As Boolean
            Dim s As String
            i = 0
            t = False
            s = UCase(txtsquadra.Text)
            Do While (i < n) And (t = False)
                If a(i) = s Then
                    t = True
                End If
                i = i + 1
            Loop
            lblpos.Text = Str(i)
        End Sub
    End Class
    

     

  • Esercizio 8 pagina 452

    Public Class Form1
        Dim a() As String
        Dim n As Integer
        Private Sub btninput_Click(sender As System.Object, e As System.EventArgs) Handles btninput.Click
            Dim i, j As Integer
            Dim app As String
            n = Val(InputBox("inserire numero di nomi da inserire"))
            ReDim a(n)
            For i = 0 To n - 1
                a(i) = UCase(InputBox("inserire nomi"))
            Next
            For i = 0 To n - 2
                For j = i + 1 To n - 1
                    If a(i) > a(j) Then
                        app = a(i)
                        a(i) = a(j)
                        a(j) = app
                    End If
                Next
            Next
        End Sub
    
        Private Sub btncerca_Click(sender As System.Object, e As System.EventArgs) Handles btncerca.Click
            Dim i As Integer
            Dim s As String
            Dim t As Boolean
            t = False
            s = UCase(txtcerca.Text)
            For i = 0 To n - 1
                If s = a(i) Then
                    t = True
                End If
            Next
            If t = True Then
                lblndacercare.Text = "nome presente"
            Else
                lblndacercare.Text = "nome non presente"
            End If
        End Sub
    End Class
    

     

  • Dati n valori, si calcoli la media, si stampino i valori superiori alla media

    Public Class Form1
        Dim a() As Integer
        Dim n As Integer
     
    
        Private Sub Btninserisci_Click(sender As System.Object, e As System.EventArgs) Handles Btninserisci.Click
            Dim s, i, c As Integer
            n = Val(txtnumeri.Text)
            ReDim a(n)
    
            For i = 0 To n - 1
                a(i) = Val(InputBox("inserisci valori"))
            Next
            
    
        End Sub
    
        Private Sub btncalcola_Click(sender As System.Object, e As System.EventArgs) Handles btncalcola.Click
            Dim s, i, c As Integer
            Dim m As Double
            s = 0
            For i = 0 To n - 1
                s = s + a(i)
            Next
            m = s / n
            i = 0
            c = 0
            For i = 0 To n - 1
                If a(i) > m Then
                    txtsm.Text = txtsm.Text + Str(a(i)) + vbCrLf
                End If
            Next
            lblmedia.Text = Str(m)
    
        End Sub
    End Class
    

     


© Emanuele Scapin 2009-2012

 

Valid HTML 4.01! Valid CSS!