All pastes #798272 Raw Edit

Stuff

public text v1 · immutable
#798272 ·published 2007-11-26 18:34 UTC
rendered paste body
 #include <stdio.h>
#define N 50
#include <math.h>
	int WeDa(double*);
	void zeruj (int, double, int, int);

int main ()
{
  double x[N];
  int n,d,g;
  n=WeDa(&x[0]);                      
	if(n==-1)
	{
	   printf("blad otwarcia pliku");
           return n;
	}
	if(n==-2)
	{
	   printf("ujemna ilosc danych");
	   return n;
	}
	if(n==-3)
	{
	   printf("zbyt duza ilosc danych");
	   return n;
	}
	printf ("podaj indeks dolny: ");
	scanf ("%d",&d);
	printf ("podaj indeks gorny: ");
        scanf ("%d",&g);


  return 0;
}
	int WeDa(double*x)
	{
	   FILE *dane, *wy;
           int ilosc, i;
	   dane=fopen("dane.txt", "r");
	   if (dane==NULL) return -1;

           fscanf(dane, "%d", &ilosc);

	   if (ilosc<=0) return -2;
	   if (ilosc>N) return -3;
       
   
       
           for (i=0; i<ilosc; i++) fscanf (dane,"%lf", &x[i],);
	    
           
	   wy = fopen ("wy.txt", "w");
           if (wy == NULL)
           fclose(dane);

           return ilosc;
       
         }

	 void zeruj (int n, double *x, int d, int g);
	{
	 for( i=0; i<N; ++i);
         {if =





         return