This is what I did and he said it is wrong but wouldn't tell me why and I don't understand what I am doing wrong
#include <stdio.h>
typedef struct
{
int yards, feet;
float inches, total;
} yardsfeetincheslength;
typedef struct
{
int yards, feet;
float inches, total;
} yardsfeetincheswidth;
typedef struct
{
yardsfeetincheslength;
yardsfeetincheswidth;
} yardsfeetinches;
int main()
{
yardsfeetinches d1, d2, d3, lw, total;
printf("Please enter the two distances in inches, feet, and yards: \n");
scanf("%f%d%d%f%d%d", &d1.inches, &d1.feet, &d1.yards, &d2.inches, &d2.feet, &d2.yards);
d1.total = (d1.inches/12.0) + (d1.feet/3.0) + d1.yards;
d2.total = (d2.inches/12.0) + (d2.feet/3.0) + d2.yards;
d3.total = d1.total + d2.total;
lw.total = d1.total * d2.total;
printf ("%.2f Total Yards One + %.2f Total Yards Two = %.2f Yards", d1.total, d2.total, d3.total);
printf ("\nThe length of %.2f times the width of %.2f equals a Area of %.2f ", d1.total, d2.total, lw.total);
}

New Topic/Question
Reply
MultiQuote








|