Ok i see what your saying. So if the questions asked me to recreate the program so that everything is done in main(), would this be essentially satisfying the requirements?
Note: I attached the full code i had with the changes.
Code:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#define tri_area (1.0/2.0)*(base)*(height)
/*
void explain_prog(void);
float get_base(void);
float get_height(void);
float tri_area(float base, float height);
void display(float b, float h, float a);
*/
main()
{
float base, height, area;
system("cls");
puts("\nThe user is asked to type in the BASE");
puts("and HEIGHT of a TRIANGLE, and the program");
puts("will output the HEIGHT, BASE, and AREA");
puts("of the TRIANGLE.");
puts("");
printf("\nPlease input BASE of your triangle: >");
scanf("%f", &base);
printf("Please input the HEIGHT of your triangle: >");
scanf("%f", &height);
area=tri_area;
printf("\nFor base %.2f and Height %.2f, the AREA is %.2f", base,height,area);
getch();
return 0;
}
/*
main ()
{
float t_base, t_height, t_area;
system("cls");
explain_prog();
get_base();
get_height();
tri_area();
//GET USER INPUT
t_base=get_base();
t_height=get_height();
//CALCULATE AREA
t_area=tri_area(t_base, t_height);
//DISPLAY RESULTS
display(t_base, t_height, t_area);
puts("");
system("pause");
}
void explain_prog(void)
{
puts("\nThe user is asked to type in the BASE");
puts("and HEIGHT of a TRIANGLE, and the program");
puts("will output the HEIGHT, BASE, and AREA");
puts("of the TRIANGLE.");
puts("");
}
float get_base(void)
{
float base;
printf("\nPlease input BASE of your triangle: >");
scanf("%f", &base);
return(base);
}
float get_height(void)
{
float height;
printf("Please input the HEIGHT of your triangle: >");
scanf("%f", &height);
return(height);
}
float tri_area(float base, float height)
{
float answer;
answer=0.5*base*height;
return(answer);
}
void display(float b, float h, float a)
{
printf("\nFor base %.2f and Height %.2f, the AREA is %.2f", b,h,a);
}
*/