Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FLUSH while(getchar()!='\n')
- #define S 15
- typedef struct {
- char cognome[S], nome[S];
- unsigned short eta;
- }tipobaseQueue;
- void LeggiStringa(char s[],unsigned long dim){
- unsigned long i=0;
- for (i=0; (s[i]=getchar())!='\n' && i<dim-1;i++);
- s[i]='\0';
- if (i==dim-1) while (getchar()!='\n');
- }
- void LeggiElementoQueue(tipobaseQueue * x){
- printf("\nInserisci il Cognome ");
- LeggiStringa(x->cognome, S);
- printf("\nInserisci il Nome ");
- LeggiStringa(x->nome, S);
- printf("\nInserisci l'eta' ");
- scanf("%d",&x->eta);
- FLUSH;
- }
- void VisualizzaElementoQueue(tipobaseQueue x){
- printf("\nCognome = %s ", x.cognome);
- printf("\nNome = %s ", x.nome);
- printf("\nEta' = %d \n\n",x.eta);
- }
Advertisement
Add Comment
Please, Sign In to add comment