Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- struct buono{
- char id[10+1];
- char dataEmissione[10+1];
- char emailCliente[250+1];
- float valore;
- char dataScadenza[10+1];
- unsigned int stato;
- };
- struct nodo{
- buono info;
- nodo*next;
- };
- nodo* creaNodo(buono b){
- nodo* n = new nodo;
- if(n == NULL) {
- return NULL;
- }
- else{
- n->info = b;
- n->next = NULL;
- }
- }
- nodo* inserimentoTesta(nodo* lista, nodo* n){
- if(lista == NULL) return n;
- if (n == NULL) return lista;
- n->next = lista;
- return n;
- }
- void stampaLista(nodo* lista){
- if(lista != NULL){
- cout<<"ID : "<<(lista->info).id;
- stampaLista(lista->next);
- }
- }
- int main(){
- nodo* lista = NULL;
- int numeroNodi;
- cout<<"Quanti nodi : ";
- cin>>numeroNodi;
- buono b = NULL;
- for(int i=0; i<numeroNodi; i++){
- b = new buono;
- b.id = i;
- nodo* temp = creaNodo(b);
- inserimentoTesta(lista, temp);
- }
- stampaLista(lista);
- //system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement