Jump to content

esperti in visual basic? (urgente)


Gabriele94

Recommended Posts

scusami ma dove si trova la sezione dal menu di sopra?

lasciate aperta il 3d perchè avrò delle domande :)

 

edit:

devo calcolare la media per ogni città. non capisco l'errore :(

Private Sub BtnCalcola_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcola.Click

Dim tot, media As Short

For I = 1 To r

tot = 0

For j = 1 To 30

tot = tot + matri(I, j)

Next j

media = tot / 30

TxtMedia.Text = CStr(media) & vbNewLine

Next I

 

 

End Sub

Link to comment
Share on other sites

per la diagonale principale supponendo matrice quadrata in pseudocodice è

somma=0;

for (t=0; t++; t

somma=somma+matrice[t][t];

}

per diagonale inversa:

 

somma=0;

for (t=0; t++; t

somma=somma+matrice[t][matrice.numerocolonne-t];

}

 

il codice poi lo devi trasformare te in VB...

Link to comment
Share on other sites

scusami ma dove si trova la sezione dal menu di sopra?

lasciate aperta il 3d perchè avrò delle domande :)

 

edit:

devo calcolare la media per ogni città. non capisco l'errore :(

Private Sub BtnCalcola_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcola.Click

Dim tot, media As Short

For I = 1 To r

tot = 0

For j = 1 To 30

tot = tot + matri(I, j)

Next j

media = tot / 30

TxtMedia.Text = CStr(media) & vbNewLine

Next I

 

 

End Sub

che problema ti da?

Link to comment
Share on other sites

scusami ti do pure il carica

Public Class Form1

Dim città As String

Dim r As Short

 

Dim matri(,) As Short

 

Private Sub BtnCarica_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCarica.Click

r = Val(InputBox("num città"))

ReDim matri(r, 30)

For i = 1 To r

città = (InputBox("nome città"))

For j = 1 To 3

matri(i, j) = Val(InputBox("temp città" & CStr(i), "nella giornata" & CStr(j)))

 

Next j

Next i

End Sub

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...