0 Members and 1 Guest are viewing this topic.
#include <iostream>#include <math.h>using namespace std;int main(void){int i,k,j,s,nb,rmin,rmax;float L,t,pi,angler,x,y;bool finRadius;nb = 10;rmin = 5;rmax = 14;pi = 4.0*atan(1.0);angler = 2.0*pi/nb;i=j=0;for(k=0;k<rmax*4*rmax-1;k++) {x=j-rmax; y=i-rmax; L=sqrt(x*x+y*y); t=acos(x/L); if (s=0>=y) t=2*pi-t; finRadius=0; while ((s<nb+1) and (finRadius==0)) {if (rmin<=L and L<=rmax and (fabs(t-(float)s*angler)<angler/L or fabs(rmin-L)<1)) cout <<(finRadius=1)-1<<"0"; else s++;} if (s==nb+1) cout << ".."; if (i++==rmax*2) {i=0;j++;cout <<endl;} }return 0;}
int main(void){ int i, k, j, s, nb, rmin, rmax; float L, t, pi, angler, x, y; bool finRadius; nb = 10; rmin = 5; rmax = 14; pi = 4.0*atan(1.0); angler = 2.0*pi / nb; i = j = 0; for (k = 0; k < rmax * 4 * rmax - 1; k++) { x = j - rmax; y = i - rmax; L = sqrt(x*x + y*y); t = acos(x / L); if (s = 0 >= y) t = 2 * pi - t; finRadius = 0; while ((s < nb + 1) and (finRadius == 0)) { if (rmin <= L and L <= rmax and (fabs(t - (float)s*angler) < angler / L or fabs(rmin - L) < 1)) { cout << (finRadius = 1) - 1 << "0"; } else { s++; } } if (s == nb + 1) cout << ".."; if (i++ == rmax * 2) { i = 0; j++; cout << endl; } } return 0;}
#include <iostream>#include <cmath>#define PI 4.0 * atan(1.0)#define NB 10#define RMIN 5#define RMAX 14#define ANGLER 2.0 * PI / NBusing namespace std;int main() { int i, k, j, s; float L, t, x, y; bool rfin; i = j = 0; for (k = 0; k < RMAX * RMAX * 4 - 1; k++) { x = j - RMAX; y = i - RMAX; L = sqrt(x*x + y*y); t = acos(x / L); if (s = 0 >= y) t = 2 * PI - t; rfin = false; while ( (s < NB + 1) && (rfin == false) ) { if ( RMIN <= L && L <= RMAX && ( fabs(t - s * ANGLER) < ANGLER / L || fabs(RMIN - L) < 1 ) ) { rfin = true; cout << "00"; } else { s++; } } if (rfin == false) cout << ".."; if (i++ == RMAX * 2) { i = 0; j++; cout << endl; } } return 0;}
cout <<(finRadius=1)-1<<"0";
cout << "00";rfin = true;