Skip to content

Instantly share code, notes, and snippets.

@ismaeldamiao
Created May 21, 2020 02:15
Show Gist options
  • Save ismaeldamiao/553c08676881dc919a70193de561dc67 to your computer and use it in GitHub Desktop.
Save ismaeldamiao/553c08676881dc919a70193de561dc67 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<math.h>
int main(void){
double x, y, theta, dt = 0.01;
FILE *arquivo = fopen("pontos.dat", "w");
for(theta = 0.0; theta <= 2.0 * M_PI; theta += dt){
x = 2.0 * cos(2.0 * theta) * cos(theta);
y = 2.0 * cos(2.0 * theta) * sin(theta);
fprintf(arquivo, "%g %g\n", x, y);
}
fclose(arquivo);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment