trying to see how to enter data into the spa struct for visit_date,
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> int client_info (struct client *D); int visit_info ( struct client *D, visitcount); struct client { char l_name[50]; char f_name[50]; char bday[15]; int height; int weight; int visits; struct spa *V; }; struct spa { char visit_date[15]; // i want to enter data in this field char treat[100]; double fee; char notes[200]; }; int main (void) { int visitcount; struct client data[100]; int i; for (i=0;i<5;i++) { data[i].V[i]= (struct spa *) malloc (5 * sizeof (struct spa)); } printf("Welcome to JP Spa Service's\n\n"); printf("Choose an option"); printf("1. Enter New Client"); printf("2. Search database by lastname"); printf("3. Search database by date of birth"); printf("4. Change Client database"); printf("5. Print record of one client"); printf("6. Print record of all clients"); printf("7. Calculate fee of client"); printf("%s", data[0].l_name); visitcount= visitcount; free ((void *) V); return(system("pause")); } int client_info (struct client *D, int visit_num) { static int x=0; char temp[550]; int temp1=0; int visitcount=0; printf("\n Enter First Name:\n"); fflush(stdin); gets(temp); strncpy (D[x].f_name, temp, 550-strlen(temp)); printf("\nEnter Last Name:\n"); fflush(stdin); gets(temp); strncpy (D[x].l_name, temp, 550-strlen(temp)); printf("\nEnter Date of Birth: (exmpl :2, Oct, 1981)"); fflush(stdin); gets(temp); strncpy (D[x].bday, temp, 550-strlen(temp)); printf("\nEnter Weight of Client:\n"); fflush(stdin); D[x].weight=atoi (gets(temp)); printf("\nEnter total number of visits:\n"); fflush(stdin); D[x].visits= atoi (gets(temp)); visit_num = D[x].visits; visit_info (D[x]->V[x], visit_num); return visit_num; } int visit_info ( struct client *D, int visit_num) { int x, y =0; if (visit_num <=5) x = visit_num; else x = 5; printf("\nEnter Spa visit date (exmpl: 23, Sep, 2002)"); return 0; }![]()
![]()



LinkBack URL
About LinkBacks



