#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 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(int argc, char * argv[]) { struct venue venarray[15]; struct event earray[20]; int totvenues = 0, totevents = 0; int i,j,k=0; char *flnm = NULL; FILE *infile; // demo of command line parameters // assume user enters a filename and two integers (venues and events) if (argc == 4) { flnm = argv[1]; totvenues = atoi(argv[2]); totevents = atoi(argv[3]); } else { printf("\nPlease restart the program and enter a filename and two integers after the program call, i.e. a.out lab4file.txt 18 3 "); } printf("\nYou entered filename %s, total venues %d, and total events %d\n",flnm,totvenues, totevents); if (flnm != NULL) infile = fopen(flnm,"r"); if (infile != NULL) fscanf(infile, "%d",&k); printf("\nValue of k from infile is %d \n",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; }