Gabriele94 Posted January 18, 2012 Share Posted January 18, 2012 sapete come calcolare in una matrice: diagonale principale e secondaria somma elementi riga e colonne. ovviamente con il codice lo so che non è il forum giusto... Quote Link to comment Share on other sites More sharing options...
tom1 Posted January 18, 2012 Share Posted January 18, 2012 appunto non è ne il forum ne la sezione adatta Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 18, 2012 Author Share Posted January 18, 2012 sperando che ci sia qualcuno Quote Link to comment Share on other sites More sharing options...
tom1 Posted January 18, 2012 Share Posted January 18, 2012 nessuno Quote Link to comment Share on other sites More sharing options...
Devil_Mcry Posted January 18, 2012 Share Posted January 18, 2012 ma cerchi funzioni gia fatte o lo devi implementare te? quelle cose in vb sono facili da fare... io usavo anni fa vb6, ora e tutto su .net ma cambia poco mi pare per queste cose Quote Link to comment Share on other sites More sharing options...
keroro.90 Posted January 19, 2012 Share Posted January 19, 2012 Se cerchi funzioni già fatte ci sono migliaia di programmi.....dal noto matlab in poi... Se invece devi farla in visual basic allora posta su programmazione... Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 19, 2012 Author Share Posted January 19, 2012 si mi serviva il codice per vedere come si fà. entro ieri però, era una cosa urgente :( ma devil mi puoi aiutare un'altra volta Quote Link to comment Share on other sites More sharing options...
Le085 Posted January 19, 2012 Share Posted January 19, 2012 spostato nella sezione adatta Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 19, 2012 Author Share Posted January 19, 2012 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 Quote Link to comment Share on other sites More sharing options...
Le085 Posted January 19, 2012 Share Posted January 19, 2012 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... Quote Link to comment Share on other sites More sharing options...
Le085 Posted January 19, 2012 Share Posted January 19, 2012 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? Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 19, 2012 Author Share Posted January 19, 2012 mi visualizza un numero che non ne è una media ne una somma Quote Link to comment Share on other sites More sharing options...
Le085 Posted January 19, 2012 Share Posted January 19, 2012 ma questo matr(I,j) che non è dichiarato dove lo prendi? non è che devi prenderlo dagli argomenti del metodo? tipo "e." e hai dentro la matrice? Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 19, 2012 Author Share Posted January 19, 2012 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 Quote Link to comment Share on other sites More sharing options...
Devil_Mcry Posted January 20, 2012 Share Posted January 20, 2012 Ma non dovrebbe essere 30 invece di 3?!? Perché se li metti 3 per provare in modo facile e di la metti 30 poi ti viene diverso il valore Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 20, 2012 Author Share Posted January 20, 2012 si ma non è quello il problema ho provato ma niente Quote Link to comment Share on other sites More sharing options...
Devil_Mcry Posted January 20, 2012 Share Posted January 20, 2012 Beh insomma ... Metti 3 valori e fai poi la media su 30 Cmq scusa una cosa, ma città non lo salvi da nessuna parte? Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 20, 2012 Author Share Posted January 20, 2012 non lo so devil cerco di capire qst linguaggio!! cmq l'ho abbiamo corretto ed è giusto ma su VB non esce al prossimo problema! i record conosci? grazie se mi dai una mano Quote Link to comment Share on other sites More sharing options...
Devil_Mcry Posted January 20, 2012 Share Posted January 20, 2012 record di cosa? database variabili complesse o file ad accesso diretto? Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted January 21, 2012 Author Share Posted January 21, 2012 un array di record detta tabella. dico record nel senso che posso inserire dati di tipo diverso Quote Link to comment Share on other sites More sharing options...
vabatta Posted February 15, 2012 Share Posted February 15, 2012 Anche se un po' tardi, se spiegassi in modo chiaro e concreto su quello che devi fare, potrei darti una mano. Quote Link to comment Share on other sites More sharing options...
Gabriele94 Posted February 16, 2012 Author Share Posted February 16, 2012 passato molto tempo ho già risolto Quote Link to comment Share on other sites More sharing options...
vabatta Posted February 16, 2012 Share Posted February 16, 2012 passato molto tempo ho già risolto Beh, nel caso in cui avrai ancora bisogno, posta che magari ti posso essere d'aiuto! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.