any sugestion were to start?
any sugestion were to start?
Consider how you're going to get the time from the system, and consider how you're going to put graphics on the screen.
-Govtcheez
[email protected]
can u help me with a graphic clock?
We all can try...
Do you know any C++, first of all... This isn't something you can just jump into saying "I want to make a clock" and get one that evening.
-Govtcheez
[email protected]
yes i'm a member to actually but i forgot to register
my nickname's pode
well i guess i can program .not so much object oriented though
and no graphics
hi
In that case - haven't you asked this before (several times)?
You're not still trying to make a clock that doesn't rely on system time, are you?
-Govtcheez
[email protected]
ok ok
i'll do it your way
yay i'm a menber( )
but how?!
> but how?!
You made 30 posts...
-Govtcheez
[email protected]
look at u 7 more to the next millenium
what's next, senior member?
Last time, if I remeber correctly you refused to give information regarding your compiler. If I was going to write a rough clock using a Windows based compiler I'd do something like -
Perhaps you can convert that to whatever compiler/os you're using.Code:#include <iostream> #include <iomanip> #include <windows.h> using namespace std; void gotoxy(int x,int y) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); COORD c = {x,y}; SetConsoleCursorPosition(hConsole,c); } int main() { int hours,minutes,seconds; cout << "Initialise Clock\n"; cout << "hours: "; cin >> hours; cout << "minutes: "; cin >> minutes; cout << "seconds: "; cin >> seconds; while(1) { if(seconds==60) { seconds=0; minutes++; } if(minutes==60) { minutes=0; hours++; } if(hours==24) hours=0; cout << setfill('0') << setw(2) << hours << ':' << setw(2) << minutes << ':' << setw(2) << seconds++; Sleep(1000); gotoxy(0,4); } return 0; }
hey that was fast
some questions:
what does the goto x,y do?
iss it nesesary?
and setfill('0')?
>what does the goto x,y do?
Moves the current cursor position to a location on the console screen
>iss it nesesary?
If you want to have the clock remain in the same place then it's one solution. Alternatively you could clear the screen each loop, or backspace to required number of characters (hackish and looks crap).
>and setfill('0')?
Sets the fill character to '0' so that a zero is displayed if the hours/minutes/seconds is below 10. With -
01:01:01
without -
1: 1: 1
can u tell me what this does
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD c = {x,y};
SetConsoleCursorPosition(hConsole,c);
}