#include #include #define MAXSEATTYPES 5 #define MAXVENUES 15 #define MINVENUES 8 #define MAXEVENTS 20 #define MINEVENTS 6 struct address { int stnum; char street[100]; int aptno; char city[100]; char state[2]; int zip5; char country[100]; }; struct seating { char stype; int smount; float discperc; float regperc; }; struct venue { int vcode; char venname[40]; char vtype; double venuecost; int vkindsstg; struct seating venseating[MAXSEATTYPES]; struct venue *next; }; struct event { int eday,emo,eyr; int elength; char esetting; double efixed; char ename[40]; }; int input(struct venue venarray[15], struct event earray[20], int tv, int te); int main(void) { int done = 0; struct venue *newven=NULL, *currven = NULL, *headven = NULL; while (!done) { newven = (struct venue *) malloc (sizeof(struct venue)); if (currven != NULL) currven->next = newven; if (headven == NULL) headven = newven; currven = newven; //print messages and read data into newven i.e. newven->vcode etc. printf("\n Stuff in linked list"); printf("\nAre you done? Enter 1 for yes and 0 for no : "); scanf("%d",&done); } //------------- /* struct venue venarray[15]; struct event earray[20]; int totvenues, totevents; int i,j,k; // call input function - user choose method; call one of 3 input methods printf("How many venues do you wish to enter? Min is 8, max is 15 : "); scanf("%d",&totvenues); printf("How many events do you wish to enter? Min is 6, max is 20 : "); scanf("%d",&totevents); printf("\nYou have %d events and %d venues to enter.",totevents, totvenues); for (i = 0; i < totvenues; i++) { printf("\nPlease enter the data for venue %d as requested below.\n",i+1); printf("\nPlease enter the code for the venue: "); scanf("%d",&(venarray[i].vcode)); printf("\nYou entered code %d", venarray[i].vcode); printf("\nPlease enter the number of kinds of seating for the venue: "); scanf("%d",&(venarray[i].vkindsstg)); printf("\nYou entered %d kinds of seating", venarray[i].vkindsstg); for (j = 0; j < venarray[i].vkindsstg; j++) { printf("\nPlease enter the data for kind of seating %d as requested below.\n",j+1); printf("\nPlease enter the code for the type of seating: "); getchar(); scanf("%c",&(venarray[i].venseating[j].stype)); printf("\nThe seat type is %c",(venarray[i].venseating[j].stype)); } } input(venarray, earray, totvenues, totevents); */ } int input(struct venue venarray[15], struct event earray[20], int tv, int te) { int m; struct venue temp; for (m = 0; m < tv; m++) { printf("\nVenue %d has code %d and %d kinds of seating",m+1,venarray[m].vcode, venarray[m].vkindsstg); } temp = venarray[0]; printf("\n\nVenue temp has code %d and %d kinds of seating",temp.vcode, temp.vkindsstg); return 1; }