Hey I have an assignment to get a number from the user and print it as a string with commas in the correct space. For example if the number is 13904 it should read 13,904 or 1005 should read 1,005. I have to do this recursively. Working on my pseudo-code I had two ideas and I got stuck on both ideas. My first idea was to take the number as a variable and enter it into a character array then add a comma in the necessary spots, this seemed easier so it is what I went with. But I could not figure how to put each separate number from the variable in each of their own spots in the array. Any help would be greatly appreciated.
MrHardRock 0 Light Poster
Philippe.Lahaie 42 Posting Whiz in Training
MrHardRock 0 Light Poster
Philippe.Lahaie 42 Posting Whiz in Training
dantinkakkar 19 Junior Poster
Philippe.Lahaie 42 Posting Whiz in Training
dantinkakkar 19 Junior Poster
Philippe.Lahaie 42 Posting Whiz in Training
dantinkakkar commented: Ya, I wrote that without seeing or checking it twice. My mistake :) Check my next post: you will find that working, I expect. It does not account for decimals, however; but that you must agree with me is easily added. +3
Philippe.Lahaie 42 Posting Whiz in Training
dantinkakkar 19 Junior Poster
Philippe.Lahaie 42 Posting Whiz in Training
Philippe.Lahaie 42 Posting Whiz in Training
dantinkakkar 19 Junior Poster
Philippe.Lahaie 42 Posting Whiz in Training
stultuske 1,116 Posting Maven Featured Poster
dantinkakkar 19 Junior Poster
Philippe.Lahaie 42 Posting Whiz in Training
dantinkakkar 19 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.