Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Printing a circle in Console for clock

$
0
0
Hey all,

I am attempting to make an ASCII console clock that consists of three circles: outer and middle circle consists of 60 chars (1-60) for seconds and minutes, inner consists of 12 or 24 chars for hours.

For starters, I want to create an ascii circle. If that works, I think I could make the rest. Problem is, is that whatever I try I cant get a circle. It does not have to be perfect, as long as it looks acceptable.
Once an attempt seemed to try and make a circle but be way out of proportion, but since I kept trying that code is lost :(.

Right now there is not much left, but here it is anyways.

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <windows.h>
#include <time.h>
#include <math.h>
#include <conio.h>

/*
*/

#ifndef PI
#define PI 3.14159265358979323846
#endif

HANDLE hOut;

int seconds, minutes, hours;

int main(void){
    hOut=GetStdHandle(STD_OUTPUT_HANDLE);
    int r;
    COORD outCoord;
	for(r=0;r<60;r++){
		outCoord.X=cos(r*PI/180*6);
		outCoord.Y=sin(r*PI/180*6);

		SetConsoleCursorPosition(hOut, outCoord);
		printf ("%i", r);
	}
	return 0;
}



C++ is an option but I have more experience with C, Although learning C++ is on my list.

Any input is welcome!
Thank you.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>