i know of a longer way to do it, just trying to find a less computative expensive mtd.Originally posted by Fatum:Hint: in C, strings are but an array of characters .......
that's all ... I'm not going to do your homework for you ...
what exactly is the question ? ...Originally posted by the_unknown:i know of a longer way to do it, just trying to find a less computative expensive mtd.
here's what i did:
for(j=0;j<3;j++){
a[j]=i%10;
i/=10;
}
thanx anyway
the question is to write a game and the reason i asked this is to update the score. as i need a way to print the score while not changing the entire screen. (using far pointer here, so i'm printing the score one by one with its attributes)Originally posted by Fatum:what exactly is the question ? ...
that's a hard coded way of doing things ... what if you don't know the size of the integer you're given ? ...
think of the hint I just gave you, and how you can convert numbers like 1500, 15, etc, into arrays of single digits ...
good luck and have fun ! ...
sprintf eh ? ... yeah ... that could convert strings to numbers ...Originally posted by the_unknown:the question is to write a game and the reason i asked this is to update the score. as i need a way to print the score while not changing the entire screen. (using far pointer here, so i'm printing the score one by one with its attributes)
as there's a max score, so the length is known.
i just realize that sprintf can do the trick!
oh you meanOriginally posted by Fatum:sprintf eh ? ... yeah ... that could convert strings to numbers ...
oh well ... I guess my second hint is obsolete then ... ... I was just going to say "char*" ....
well, good luck ! ... it's time for me to go to bed ...