-
clock
how do i make a clock ticker to display in the same place
u know like an ordinary digi clock
i have heard u should use setw()?
how does it work?
can someone show me an example please
p.s
i don't want to use the computers own time or anuthing like
i just want to do all the parts by hand!
-
Check out the functions in the time.h header.
I hate to tell you but at some point you're going to have to rely on the system for the time. (Unless of course you just ask the user for the current time constantly)
-
yes that was just what i meant the time.h
i dont want to use
-
-
> yes that was just what i meant the time.h
> i dont want to use
time.h doesn't draw the time, nor print the time, it just tells you the time
It's up to you to put that on screen in any way you can think of doing it.
-
about the time in the same spot
any suggestions?
-
That would require more information about which OS and compiler you are using.
Cursor positioning and graphics are not standard.
-
As you haven't given us your compiler, this'd be a start -
Code:
#include <iostream>
using namespace std;
int main() {
int time = 10000000;
while(time<99999999)
{
cout << time++;
cout << "\b\b\b\b\b\b\b\b";
}
}
-
the last code was very helpful thanks
i tried to write something like this
#include <iostream.h>
int main() {
int time = 10000000;
while(time<99999999)
{ cout<<"timeis:";
cout<<"\b\b\b\b\b\b\b\b\b\b\b";
cout << "\b\b\b\b\b\b\b\b";
cout<<time++;
}
return 0;
}
i just added "thetimeis:"and some\b:s but the timeis doesn't show when i run it!
-
Oh that's how you do time? I never knew you could loop and tell time.
Although, I should point out that it will loop very fast and not be very useful.
I think a larger concept is being missed here.
To each his own.
-
not really at least one number changes after the same time it takes for a sec.
<I think a larger concept is being missed here.
<To each his own.
?
what?
did u mean?
-
cout is an object of class ostream. Inside cout there is a buffer .This buffer is only emptied when one of these occur.
1) an endl in the stream .... endl.... not \n
2) the flush manipulator in the stream. i.e. cout<<"This will be shown because buffer is flushed"<<flush;
3) an input operation through istream. This is because cout is tied to cin so that everytime cin is used cout flushes its buffer.
4) when the buffer is full
Now I'll let you work out your missing output problem.....