Overclock.net banner

1 - 14 of 14 Posts

·
Premium Member
Joined
·
46,116 Posts
Discussion Starter #1
If I've got an array of integers, how do I output them as (for example) 999,999 instead of 999999?

 

·
Registered
Joined
·
1,350 Posts
Umm off the top of my head you could probably concatenate all of it as a string. Store both halves into a separate string and concatenate it all with a comma. Maybe not the best solution, but would probably work.
 
  • Rep+
Reactions: zodac

·
Premium Member
Joined
·
46,116 Posts
Discussion Starter #3
And I would do that how?
 

·
Registered
Joined
·
1,350 Posts
Is the value 999,999 a single item in the array? Or is each 9 an element in the array?
 

·
Premium Member
Joined
·
46,116 Posts
Discussion Starter #5
Single item.
 

·
Premium Member
Joined
·
46,116 Posts
Discussion Starter #8
Quote:

Originally Posted by fshizl View Post
couldnt you type it in? 999,999???

if anything do float p=999,999 example... float will let you use decimals, it might also let you use comas
Well, I'm calculating primes, then putting them into an array, so I don't think that would work...

Quote:

Originally Posted by TheSchlaf View Post
see here:

http://www.daniweb.com/forums/thread261786.html

GIYF.
Using that method, would I have to convert every item in the array to a string, or is there a faster method?
 

·
Premium Member
Joined
·
46,116 Posts
Discussion Starter #10
It changes... looking for all primes from 1-100, then anywhere up to 10,000,000...
 

·
Premium Member
Joined
·
46,116 Posts
Discussion Starter #12
My code isn't anywhere near done, since I need to do other stuff to it first (some bitshifting involved, and gotta try that next).

I was hoping that seperating by commas would be an easy task... doesn't look like it though.
 

·
Premium Member
Joined
·
46,116 Posts
Discussion Starter #14
Something from the link seemed to work, but when I used it in another code, it messed things up...

I think I'll leave it for now. If I finish the code and have some spare time, I'll try it out again, but for now, I think it'll just confuse me more.


Thank you to everyone for your help.
 
1 - 14 of 14 Posts
Top