#include #include #include #define C 25 #define PI M_PI void rucicka(char out[60][60], double pol, int velkost) { char ruc[60][60]; int i,j,x,y,qx,qy,dx,dy; double x2,y2; x2 = 250*(sin(pol*2*PI)); y2 = -250*(cos(pol*2*PI)); //ruc[(int)round(C+x2)][(int)round(C+y2)]='.'; memset(ruc, 0, 60*60); if (pol<0.125 || pol>0.875 || (pol>0.375 && pol < 0.625)) { // | if (y2<0) { for (y=0; y>=y2; y--) { qx=round(y*x2/y2); qy=y; //printf("%d,%d\n", qx, qy); if (abs(qx)<24 && abs(qy)<24) ruc[C+qx][C+qy]=':'; } } else { for (y=0; y<=y2; y++) { qx=round(y*x2/y2); qy=y; if (abs(qx)<24 && abs(qy)<24) ruc[C+(int)round(y*x2/y2)][C+y]=':'; } } } else { // - if (x2<0) { for (x=0; x>=x2; x--) { qx=x; qy=round(x*y2/x2); if (abs(qx)<24 && abs(qy)<24) ruc[C+x][C+(int)round(x*y2/x2)]=':'; } } else { for (x=0; x<=x2; x++) { qx=x; qy=round(x*y2/x2); if (abs(qx)<24 && abs(qy)<24) ruc[C+x][C+(int)round(x*y2/x2)]=':'; } } } ruc[C][C]=0; for (y=0; y<51; y++) { for (x=0; x<51; x++) { dx = abs(C-x); dy = abs(C-y); if (dx*dx+dy*dy > velkost*velkost) continue; if (!ruc[x][y]) continue; if (ruc[x-1][y] && ruc[x+1][y]) out[x][y]='-'; else if (ruc[x][y-1] && ruc[x][y+1]) out[x][y]='|'; else if (ruc[x-1][y-1] && ruc[x+1][y+1]) out[x][y]='\\'; else if (ruc[x-1][y+1] && ruc[x+1][y-1]) out[x][y]='/'; else out[x][y]='o'; } } } void vykresli(int h, int m) { char out[60][60],c; int i,j; memset(out,' ',60*60); for (i=0; i<51; i++) { c=(i%10)?'X':'@'; out[i][0]=c; out[i][50]=c; out[0][i]=c; out[50][i]=c; } out[C-1][ 2] = '1'; out[C+1][ 2] = '2'; out[C][ 48] = '6'; out[2][ C] = '9'; out[48][ C] = '3'; rucicka(out, (60.0*(h%12)+m)/(12*60), 15); rucicka(out, m/60.0, 21); out[C][C] = '*'; for (i=0; i<51; i++) { for (j=0; j<51; j++) { putc(out[j][i],stdout); } putc('\n', stdout); } putc('\n', stdout); } int main(int argc, char **argv) { char line[16]; int h,m; while (1) { fgets(line,15,stdin); if (line[0]=='E') break; //puts(line); sscanf(line, "%d:%d", &h, &m); //printf("%d %d\n", h, m); vykresli(h,m); } return 0; }