| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: c++ help |
From: John Beckett On Sun, 5 Dec 2004 11:51:36 -0500, "Geo" wrote: > let me know if you see any technical errors in the above Your code works fine. You should take the time to understand my earlier post because it contains standard C procedures that must be mastered. I did not use itoa but instead performed the dirty trick of adding 48 to convert a digit to an ascii character. Paul was too polite to point out that my code is straight out of the Ark. His posts show proper procedures, but from your stated aims, you need to master the basic C skills, even if they are ugly. Another point, probably unimportant. You could extract the three digits that you want from one call to rand, as below: int n = rand(); itoa((n%10),a,10); itoa(((n/10)%10),b,10); itoa(((n/100)%10),c,10); John --- BBBS/NT v4.01 Flag-5* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45) SEEN-BY: 633/267 270 5030/786 @PATH: 379/45 1 396/45 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.