Programming Project 1

Embed Size (px)

DESCRIPTION

programming

Citation preview

#includevoid input_vehicle(char vehicletype[], int time_in[], int time_out[], float alltotal[]);void display(char vehicletype[], int time_in[], int time_out[], float alltotal[]);void title(void);void line(void);int q=0;int main(){ char vehicletype[10];int time_in[10];int time_out[10];int alltotal[10];int option;char cont;system("title PARKING LOT CHARGE");title();puts("1. Input vehicle");puts("2. Display all vehicles report");puts("3. Exit");printf("Enter your option:");fflush(stdin);scanf("%d", &option);switch(option){case 1: system("CLS");input_vehicle(vehicletype, time_in, time_out, alltotal);break;case 2: system("CLS");display(vehicletype, time_in, time_out, alltotal);break;case 3: break;default: puts("INVALID!\a");} system("pause"); return 0;}

void input_vehicle(char vehicletype[], int time_in[], int time_out[], float alltotal[]){char vehicle, cont;float total;int parking_time, hour_enter, hour_left;do{do{title();printf("Types of vehicle(C-car, B-bus, T-truck):");fflush(stdin);scanf("%c", &vehicle);fflush(stdin);switch(vehicle){case 'C':case 'c':break;case 'B':case 'b':break;case 'T':case 't':break;default :puts("INVALID!\n\a");}}while(vehicle!='C' && vehicle!='c' && vehicle!='B' && vehicle!='b' && vehicle!='T' && vehicle!='t');printf("Hours vehicle entered lot(0-24)\t\t:");scanf("%d", &hour_enter);printf("Hour vehicle left lot(0-24)\t\t:");scanf("%d", &hour_left);line();switch(vehicle){case 'C':case 'c':puts("Type of vehicle\t\t: CAR");break;case 'B':case 'b':puts("Type of vehicle\t\t: BUS");break;case 'T':case 't':puts("Type of vehicle\t\t: TRUCK");break;}printf("TIME-IN\t\t\t: %d\n", hour_enter);printf("TIME-OUT\t\t: %d\n", hour_left);if(hour_left