- #include <iostream>
- #include <string.h>
- using namespace std;
- typedef struct{
- char lettera[10];
- int n;
- }livelliLinguistici;
- typedef struct{
- int anno;
- char sezione[10];
- }classi;
- typedef struct {
- int codice;
- classi classe;
- livelliLinguistici livelloLinguistico;
- }studente;
- int main(){
- studente studenti [4];
- for(int i=0;i<4; i++){
- cout<<"inserire codice studente "<<i+1<<": ";
- cin>>studenti[i].codice;
- cout<<"inserire il livello linguistico dello studente(lettera)"<<i+1<<": ";
- cin.ignore();
- cin.getline(studenti[i].livelloLinguistico.lettera, 10, '\n');
- cout<<"inserire il livello linguistico dello studente(numero)";
- cin>>studenti[i].livelloLinguistico.n;
- cout<<"inserie la classe dello studente (anno)"<<i+1<<": ";
- cin>>studenti[i].classe.anno;
- cout<<"inserie la classe dello studente (anno)"<<i+1<<": ";
- cin.ignore();
- cin.getline(studenti[i].classe.sezione, 10, '\n');
- }
- //stampa
- for(int i=0;i<4;i++){
- cout<<studenti[i].codice<<" ";
- cout<<studenti[i].livelloLinguistico.lettera;
- cout<<studenti[i].livelloLinguistico.n<<" ";
- cout<<studenti[i].classe.anno;
- cout<<studenti[i].classe.sezione<<endl;
- }
- }
[text] struct livello linguistico
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: