Staredit Network > Forums > Technology & Computers > Topic: C++ GetTickCount
C++ GetTickCount
Jul 20 2009, 2:12 pm
By: FatalException  

Jul 20 2009, 2:12 pm FatalException Post #1



In C++, is there a way to check individual digits in the tick count? I want to use the tick count to generate semi-random simple arithmetic problems with the following form: x (+, -, *) y = z. I would use tenths of seconds (hundreds of ticks) to determine x, hundredths of seconds (tens of ticks) to determine the operation, and milliseconds to determine y. The user inputs z.

If not, is there another way to do this?



None.

Jul 20 2009, 4:09 pm Heinermann Post #2

memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes memes

int count = GetTickCount();
int x = count \ 100;
int op = count \ 10;
int y = count;

But you want the single digits(in decimal) in those placess, right?

int count = GetTickCount();
int x = (count \ 100) % 1000;
int op = (count \ 10) % 100;
int y = count % 10;




Jul 20 2009, 8:05 pm FatalException Post #3



Well, the problem with that way is that (correct me if I'm wrong), GetTickCount tracks the number of milliseconds since the CPU was turned on, so just dividing the tick count can give huge results that I don't really want if I've left my computer on. I could just check each number to see if it's greater than 10, 100, 1000, etc. and divide accordingly, but I'd rather not do that if there's a simpler way.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:29 pm]
Vrael -- idk what I did but I like triple-posted in SD sorry
[02:45 pm]
NudeRaider -- Oh_Man
Oh_Man shouted: have i ever told u guys my SC2 pro-gamer story
how many GSL titles?
[2026-7-27. : 10:41 am]
ManCubuS -- Seems like something's broken regarding the site then. Sadge...
[2026-7-27. : 7:36 am]
Oh_Man -- have i ever told u guys my SC2 pro-gamer story
[2026-7-26. : 11:30 pm]
Ultraviolet -- That's strange, it looks like you targeted the base image file (sometimes people make the mistake of just using the imgur page link which doesn't work for embedding) but it still didn't work it sounds like.
[2026-7-26. : 3:34 pm]
ManCubuS -- Used : " [img=https://i.imgur.com/gpOjTuD.jpeg] "
[2026-7-26. : 3:28 pm]
ManCubuS -- Even tried with imgur, doesn't attach.
[2026-7-26. : 3:14 pm]
ManCubuS -- I should try a workaround, thanks! Sadly imgur is blocked in my country for some unknown reason.
[2026-7-26. : 3:05 pm]
NudeRaider -- I think SEN has trouble with https or hotlinking is forbidden. It certainly is nothing about the size, it just fails to get any size. You can get it working if you use imgur and include the actual image link for the img tag. Like this: [img=https://i.imgur.com/ddYqXZa.jpeg]
[2026-7-26. : 11:15 am]
ManCubuS -- Hey fellas! Anyone knows why when I try to upload an image it says "failed to get image size"? I even tried making it so small. Imgur isn't working here and I tried postimg no luck.
Please log in to shout.


Members Online: RIVE