
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

#define pi 3.14159
#define h 6.26E-34
#define k 1.38E-23
#define dfreq 0.1E+14
#define dtemp 500
#define vluz 3E8
using namespace std;

int main(){

    float freq=0,temp=50;
    int j=0;

    FILE *datos;
    datos=fopen("planck.dat","w");
    fprintf(datos,"#Densidad en función de la frecuencia\n");

	while(temp<=3000){
		fprintf(datos,"#Temperatura=%f PIÑAS\n",temp);
		fprintf(datos,"#Frecuencia\tRHO(Freq)\n");
        while(j<=100){
        	fprintf(datos,"%f \t %.100lf \n",freq,(((8*pi*h*(freq*freq*freq))/\
        	(vluz*vluz*vluz))*(1/(exp((h*freq)/(k*temp))-1))));
        	freq+=dfreq;
		j++;
            }
		fprintf(datos,"\n\n"); //Un nuevo índice
		temp+=dtemp;
		freq=0;
		j=0;
	}
    printf("ok!\n");
}
