DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio –...
-
Upload
gaspare-lopez -
Category
Documents
-
view
216 -
download
1
Transcript of DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio –...
![Page 1: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/1.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Esercitazione 1Esercitazione 1
Marco D. Santambrogio – [email protected]. aggiornata al 9 Aprile 2014
![Page 2: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/2.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Confronta StringheConfronta Stringhe
• Si scriva in C un programma che date due stringhe inserite dall’utente dice quale delle due precede alfabeticamente l’altra. Non si può usare la funzione strcmp
Esempio 1 - dati:
array1=”pippo” - array2=”pio”Esempio 1 - risultato:
L’array2 precede l’array1 Esempio 2 - dati:
array1=”super”- array2=”supercalifragili” Esempio 2 - risultato:
L’array1 precede l’array2
2
![Page 3: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/3.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Confronta StringheConfronta Stringhe
3
![Page 4: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/4.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Confronta Stringhe: Confronta Stringhe: InserimentoInserimento
4
![Page 5: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/5.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Confronta Stringhe: Confronta Stringhe: ConfrontoConfronto
5
![Page 6: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/6.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Confronta Stringhe: Confronta Stringhe: RisultatoRisultato
6
![Page 7: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/7.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Problema…Problema…
7
![Page 8: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/8.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Problema…Problema…
8
![Page 9: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/9.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Problema…Problema…
9
![Page 10: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/10.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Versione corretta ;)Versione corretta ;)
10
![Page 11: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/11.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
11
Matrice traspostaMatrice trasposta
• Si definisce matrice trasposta AT di A la matrice ottenuta scambiando ordinatamente le righe con le colonne della matrice A.
• Es:
![Page 12: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/12.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Matrice traspostaMatrice trasposta
• In pratica, l’elemento a(i,j) della matrice A diventa l’elemento a(j,i) della matrice AT.
• Scrivere un programma che calcoli la matrice trasposta di una matrice 4x4 (4 righe, 4 colonne) di numeri reali maggiori o uguali a 0.
12
![Page 13: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/13.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Matrice trasposta – SoluzioniMatrice trasposta – Soluzioni
13
![Page 14: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/14.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Matrice trasposta – DatiMatrice trasposta – Dati
14
![Page 15: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/15.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Matrice trasposta: Matrice trasposta: InserimentoInserimento
15
![Page 16: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/16.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Matrice trasposta: CalcoloMatrice trasposta: Calcolo
16
![Page 17: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/17.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Matrice trasposta V2Matrice trasposta V2
17
![Page 18: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/18.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Matrice trasposta V2Matrice trasposta V2
18
![Page 19: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/19.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Schedine: problemaSchedine: problema
• Il programma, partendo da un array di dimensione prefissata che contiene in ogni cella: data della giocata colonna con i tredici segni
• Copia in un altro vettore solo le giocate dell’anno 2010
• Quindi, visualizza queste giocate.
19
![Page 20: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/20.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Schedine: datiSchedine: dati
20
![Page 21: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/21.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Schedine: inserimento datiSchedine: inserimento dati
21
![Page 22: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/22.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Schedine: copia valoriSchedine: copia valori
22
![Page 23: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/23.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Schedine: stampa dei Schedine: stampa dei risultatirisultati
23
![Page 24: DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE Esercitazione 1 Marco D. Santambrogio – marco.santambrogio@polimi.it Ver. aggiornata al 9 Aprile 2014.](https://reader036.fdocument.pub/reader036/viewer/2022070313/5542eb6b497959361e8d7164/html5/thumbnails/24.jpg)
DIPARTIMENTO DI ELETTRONICA E INFORMAZIONE
Fine…Fine…
24