header.h #include<stdio.h> #include<conio.

h> void *xmalloc ( size_t size ); char *citire_nume (); double **aloc2d (size_t n,size_t m); double **citire_pl (int n,int m ); double *citire_pr (int m) ; void afisare (int n,int m,double **p,double *s,char *nume); int prelf(); double f1(int n,int m,double **p,double *s); double f2(int n,int m,double **p,double *s); double f3(int n,int m,double **p,double *s); functii.h include <stdio.h> #include <stdlib.h> #include "header.h" void *xmalloc (size_t size ) { void *p=malloc (size); if (p==NULL) { printf ("memorie insuficienta"); exit (1); } return p; } char *citire_nume () { char *p; p=(char*)xmalloc (100*sizeof(char)); fflush(stdin); fgets(p,100,stdin); return p; } double **aloc2d (size_t n,size_t m) { double **mat; int i; mat=(double **)xmalloc(n*sizeof (double *)); for (i=0;i<n;i++) mat[i]=(double *)xmalloc (m*sizeof (double)); return mat; } double **citire_pl (int n,int m) { double **mat; int i,j; mat=aloc2d (n,m); for (i=0;i<n;i++) for (j=0;j<m;j++) do { scanf ("%lf" ,&mat[i][j]); if (mat[i][j]<=0) printf ("redati"); }

printf ("\nDati prelucrare dorita 1/2/3: ").int m. } int prelf() { int prel. printf ("\nSt de cerc. pr=(double *)xmalloc (m*sizeof (double)).j.double **p.double *s.s[i]). return pr. } while (pr[i]<=0).i<m.m).while (mat[i][j]<=0).2lf". } void afisare (int n. ag. } double *citire_pr (int m) { double *pr.i++) { for (j=0.&prel) . %s are %dx%d parcele cultivate cu plante med.nume.double **p.j++) printf ( "%8. printf ("\n").i<m.i<n.j<m. return a.int m.double *s) { double a.p[i][j]). scanf (" %d".n. return a. } . &pr[i]). } double f2(int n.int m. if (pr[i]<=0) printf ("redati"). for (i=0. return a. de pe care se obtine un prod: \n". } double f1(int n.i++) printf ("%10. printf ("\nS-a ales prel 2"). return prel.i++) do { scanf ("%lf". printf ("\nS-a ales prel 3"). int i.int m. } printf ("\nPreturile pe kg de pe coloane sunt:").double **p. printf ("\nS-a ales prel 1").double *s) { double a.double **p. return mat.char *nume) { int i. for (i=0. } double f3(int n. for (i=0.double *s) { double a.2lf".

printf( "\nDati productia de plante: \n").p. afisare (n. char *nume. printf ("\nDoriti sa continuati? da-1. free (nume).m. printf (" \nDati pretul pe coloane: \n"). free (s).main.p.s.c #include <stdio. double **p. s=citire_pr(m). scanf (" %d %d". return 0.m. printf ("\nDati nr de randuri si numarul de parcele pe f iecare rand: \n"). } .p.m. double *s. p=citire_pl (n. prel=prelf().nume).h> #include <stdlib. } while (gata). scanf ("%d".m).h" int main (void) { int n. case 2:f2(n.break.break. } free(p). nume=citire_nume(). do { printf ("\nDati numele plantatiei:\n").prel.s).&gata).h> #include "header.&n.&m). switch(prel) { case 1:f1(n. case 3:f3(n.m.s).break.m.gata.nu-0 ").s).p.

Sign up to vote on this title
UsefulNot useful