Document information
- University
- Politecnico di Milano
- Degree programme
- Common Courses
- Subject
- Informatica
- Material language
- Italian
- Classification
- Notes · Complete set
- Original format
- Text
- Searchable text
Study material for Informatica, shared by the Studwiz community and reviewed by moderators.
Study material for Informatica, shared by the Studwiz community and reviewed by moderators.
Import quality: text was extracted directly from the original document.
Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.
Appunti per esame Informatica B Programmazione C #include <stdio.h> #include <string.h> #include <math.h> #define n (valore che voglio dare) Per uguagliare due array in C devo necessariamente costruire un ciclo che uguagli elemento per elemento. PER INSERIRE UNA MATRICE: typedef int matrice[N][M]; void..{ matrice m1,m2,m9; PER DEFINIRE LE STRUCT: typedef (char/int) (nome array)[numero di elem]; typedef struct {[tipo di variabile] [nome variabile]; ... [se la variabile è struct/array lo definisco prima] }(nome struct); typedef (nome struct) (Nome che voglio dare)[numero elem]; INIZIALIZZARE UN PROGRAMMA: void main(){ (definizione delle variabili – int/char/float/duble) (definizione nomi delle struct create - esempio: (Nome che ho dato all’inizio) giovanni;) In printf e scanf uso: - %d se int - %s se stringa - %f se float - %c se singolo carattere I commenti si inseriscono /* commento */ _______________________________________________________________________________________ ESEMPIO RUBRICA, POPOLAMENTO E VISUALIZZAZIONE: #include <stdio.h> #define N 3 #define M 25 typedef char array[M]; typedef struct {array Nome; array Cognome; array Numero; array Mail; int Eta; }Contatto; typedef Contatto Rubrica[N]; void main() {int i,opz,num_contatti; array cognome; Rubrica rubrica; num_contatti=0; opz= -1; while(opz!=0){ printf("\n"); printf("-Premi 1 per inserire contatto\n"); printf("-Premi 2 per cercare contatto\n"); printf("-Premi 3 per visualizzare i contatti\n"); printf("-Premi 0 per uscire\n"); scanf("%d",&opz); if(opz==1){ if(num_contatti<N){ printf("\nNome: "); scanf("%s",rubrica[num_contatti].Nome); printf("Cognome: "); scanf("%s",rubrica[num_contatti].Cognome); printf("Numero: "); scanf("%s",rubrica[num_contatti].Numero); printf("Mail: ");…
First page of the document.