Elenet.net
+1 voto
#include <iostream>
using namespace std;
struct artist
{
    string nome;
    string cognome;
    int eta;
    string citta;
    int identificativo;
};

struct quadr
{
    string titolo;
    float prezzo;
    float dimensioni;
    string tecnica;
    int identificativo;
    
};    

int main(int argc, char **argv)
{
    int artista;
    int quadro;
    cout<<"\n Quanti artisti vuoi inserire? ";
    cin>>artista;
    cout<<"\n Quanti quadri vuoi inserire? ";
    cin>>quadro;

    artist identificativ [artista];
    quadr identificati [quadro];
    
    for ( int k=0; k<artista; k++ )
    {
        
        cout<<"\n Qual è il nome dell'artista che vuoi inserire? ";
        cin>>identificativ[k].nome;
        cout<<"\n Qual è il cognome dell'artista? ";
        cin>>identificativ[k].cognome;
        cout<<"\n Quanti anni ha? ";
        cin>>identificativ[k].eta;
        cout<<"\n In che città vive/viveva? ";
        cin>>identificativ[k].citta;
        cout<<"\n Qual è il suo identificativo? ";
        cin>>identificativ[k].identificativo;
    }
    
    for ( int j=0; j<quadro; j++ )
    {
        
        cout<<"\n Qual è il titolo del quadro? ";
        cin>>identificati[j].titolo;
        cout<<"\n Qual è il suo prezzo? ";
        cin>>identificati[j].prezzo;
        cout<<"\n Quali sono le sue dimensioni? ";
        cin>>identificati[j].dimensioni;
        cout<<"\n Qual è la tecnica del quadro? ";
        cin>>identificati[j].tecnica;
        cout<<"\n Qual è l'identificativo del quadro? ";
        cin>>identificati[j].identificativo;
        
        
        
    }
    
    for ( int i=0; i<quadro; i++ )
    {
        for ( int p=0; p<artista; p++ )
        {
            if ( identificati[i].identificativo==identificativ[p].identificativo )
            {
                cout<<"\n Il quadro è stato dipinto da: "<<identificativ[p].nome<< " "<<identificativ[p].cognome;
                cout<<"\n Il suo identificativo è: "<<identificativ[p].identificativo<<" ";
                
            }
        }
    }
                
    
    return 0;
}
quesito posto 16 Marzo 2017 in Classe terza da Marts (35 punti)
  

1 Risposta

+1 voto
Ok , per esercitarti ,potresti aggiungere altre strutture a piacere oltre a quelle che hai fatto, e fare delle relazioni fra di esse
risposta inviata 16 Marzo 2017 da Laura Guccione Corsista (149 punti)

Domande correlate

0 voti
0 risposte
+1 voto
0 risposte
quesito posto 16 Marzo 2017 in Informatica da FedericoSpinoso00 (26 punti) | 51 visite
0 voti
2 risposte
quesito posto 26 Marzo 2017 in Classe terza da ChiaraCarli Corsista (49 punti) | 181 visite
778 domande
1,565 risposte
639 commenti
1,445 utenti