Препод сказал нет очистки памяти, но я не понимаю зачем ее тут делать и как?
#include
#include
#include
"romb.h"
int
main()
{
int
x1, x2;
printf("Vvedite d1 d2: ");
scanf("%d",&x1);
scanf("%d",&x2);
romb *r =
new_romb(x1,x2);
printf("\nSTORONA = %.2f", r->a);
printf("\nP = %.2f", perimetr(r));
printf("\nS = %.2f", square(r));
getch();
return
0;
}
2) #ifndef Y_Romb
#define
Y_Romb
#include
#include
struct
romb {
int
d1;
int
d2;
double
a;}; romb*
new_romb(int t1, int
t2){romb* p
=(romb*) malloc(sizeof(romb));if
(p != NULL) { p->d1 = t1; p->d2 = t2; p->a
=(double) 1/2* (double)
sqrtf(t1*t1+t2*t2); }return
p;}