Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- int main(){
- int i,l;
- char array[2000], array1[2000];
- FILE *fp;
- FILE *fl;
- fp=fopen("rule90.dat","w+");
- fl=fopen("rule90.gnu","w");
- for(i=0;i<2000;i++){ //inizializzo a zero
- array1[i]=0;
- array[i]=0;
- }
- array[1000]=1;
- for(l=0;l<1000;l++){
- for(i=0;i<2000;i++){ //determino linea successiva
- array1[i]=array[i-1] ^ array[i+1];
- if( array[i]== 1 )fprintf(fp,"%d %d\n",i,l);
- }
- for(i=0;i<2000;i++){ //sostituisco
- array[i]=array1[i];
- }
- }
- fprintf(fl, " plot 'rule90.dat' lt rgb '#0AA424' \n set xlabel 'gittata massima' \n set ylabel 'dt' \n set term post col \n set output 'eull.ps' \n replot \n pause -1 \n \n ");
- fclose(fl);
- fclose(fp);
- system("gnuplot rule90.gnu");
- }
Advertisement
Add Comment
Please, Sign In to add comment