The code is essentially complete but I am having difficulty outputting the numerical inputs. The areas that are causing the program to fail have been commented out.
I imagine it's something simple such as scanning the data in as the wrong datatype but I couldn't figure it out.Code:#include <stdio.h> #include <string.h> typedef struct { char make[15]; char model[15]; int odom; }auto_t; typedef struct { char manmonth[10]; int manday; int manyear; char purmonth[10]; int purday; int puryear; }date_t; typedef struct { int tankcap; double tankcur; }tank_t; void scan_auto (auto_t *a_car); void scan_dates (date_t *a_date); void scan_tank (tank_t *a_tank); void print_auto (auto_t a_car); void print_dates (date_t a_date); void print_tank (tank_t a_tank); int main(void) { auto_t this_car; scan_auto(&this_car); date_t this_date; scan_dates(&this_date); /* tank_t this_tank; scan_tank(&this_tank);*/ print_auto(this_car); print_dates(this_date); /* print_tank(this_tank);*/ return 0; } void scan_auto(auto_t *a_car) {printf("Enter make of automobile: "); gets((*a_car).make); printf("Enter model of automobile: "); gets((*a_car).model); /* printf("Enter mileage of automobile: "); gets((*a_car).odom);*/ return; } void scan_dates(date_t *a_date) {printf("Enter the month of manufacturing: "); gets((*a_date).manmonth); /* printf("Enter the day of manufacturing: "); gets((*a_date).manday); printf("Enter the year of manufacturing: "); gets((*a_date).manyear);*/ printf("Enter the month of purchase: "); gets((*a_date).purmonth); /* printf("Enter the day of purchase: "); gets((*a_date).purday); printf("Enter the year of purchase: "); gets((*a_date).puryear);*/ return; } void print_auto(auto_t a_car) {printf("Entering this automobile\n"); printf("Make is %s\n", a_car.make); printf("Model is %s\n", a_car.model); /* printf("Mileage is %s\n", a_car.odom);*/ return; } void print_dates(date_t a_date) {printf("Manufactured in %s\n", a_date.manmonth); /* printf("on the %sth day of", a_date.manday); printf("%s", a_date.manyear);*/ printf("Purchased in %s\n", a_date.purmonth); /* printf("on the %sth day of", a_date.purday); printf("%s", a_date.puryear);*/ return; } /*void scan_tank(tank_t *a_tank) {printf("Enter the tank capacity: "); gets((*a_tank).tankcap); printf("Enter current fuel level in gallons: "); gets((*a_tank).tankcur); return; } void print_tank(tank_t a_tank) {printf("Tank capacity: %s gallons\n", a_tank.tankcap); printf("Current tank level: %s gallons\n", a_tank.tankcur); return; }*/



LinkBack URL
About LinkBacks


