opis: program zapisuje do pliku z danymi punkty z krzywej opisanej przez wzor o okreslonej liczbie parametrow, o ktore program zapyta. <verbatim> #include<stdio.h> #include<math.h> #define KROK 0.001 #define FIMAX 100 float potega(float a, float b); main() { float a,b,c1,c2,c3,d,fi,r,x,y,pom1,pom2,pom3; FILE *plik; char *nazwa; nazwa="rysunek.dat"; plik=fopen(nazwa,"w"); printf("podaj parametry superwzoru\n"); printf("a= "); scanf("%f",&a); printf("b= "); scanf("%f",&b); printf("c1= "); scanf("%f",&c1); printf("c2= "); scanf("%f",&c2); printf("c3= "); scanf("%f",&c3); printf("d= "); scanf("%f",&d); for (fi=0; fi<=FIMAX; fi=fi+KROK) { pom1=fabs(1/a*cos(d*fi/4)); pom2=fabs(1/b*sin(d*fi/4)); pom3=potega(pom1,c2)+potega(pom2,c3); r=1*potega(pom3,(-1/c1)); /*tu mozesz wstawic zamiast 1 inna funkcje*/ x=r*cos(fi); y=r*sin(fi); fprintf(plik,"%10.5f%10.5f\n",x,y); } fclose(plik); return 0; } float potega(float a,float b) { float c; c=exp(b*log(a)); return c; } </verbatim> -- Main.AgnieszkaB - 09 Mar 2005
This topic: Main
>
TWikiUsers
>
AgnieszkaB
>
SuperWzor
Topic revision:
09 Mar 2005,
AgnieszkaB
(raw view)
Copyright © CC-BY-SA by the contributing authors. All material on this collaboration platform is copyrighted under CC-BY-SA by the contributing authors unless otherwise noted.
Ideas, requests, problems regarding Foswiki?
Send feedback