Results 1 to 3 of 3

Thread: [+rep] simple c++ help

  1. #1


    Join Date
    Apr 2013
    Gender
    Posts
    85
    Thanks
    7
    Thanked 14 Times in 12 Posts


    Downloads
    25
    Uploads
    0
    Mentioned
    7 Post(s)
    Time Online
    2 d 17 h 18 m
    Avg. Time Online
    2 m
    Rep Power
    5

    [+rep] simple c++ help

    i have attached a notepad file which contains data for a project i am doing. The file is supposed to have 3 columns with numbers. i need someone to write a c++ code which puts a space/newline after every 14th character so that the numbers come out proper. Just keep it in a txt file.
    The format should be:
    xxxx xxxx xxxx
    xxxx xxxx xxxx
    xxxx xxxx xxxx

    yea you get the picture. I will FULL(as much as i can rep you) rep anyone who can get this done.
    Attached Files Attached Files
    Last edited by naruto; 06-05-2013 at 11:54 PM.

  2. #2


    Join Date
    Apr 2013
    Gender
    Posts
    85
    Thanks
    7
    Thanked 14 Times in 12 Posts


    Downloads
    25
    Uploads
    0
    Mentioned
    7 Post(s)
    Time Online
    2 d 17 h 18 m
    Avg. Time Online
    2 m
    Rep Power
    5
    still need it, if anyone can help it would be greatly appreciated.

  3. #3
    Banned
    Join Date
    Jun 2012
    Gender
    Location
    90 90
    Age
    31
    Posts
    1,714
    Thanks
    876
    Thanked 2,877 Times in 1,139 Posts


    Downloads
    44
    Uploads
    1
    Mentioned
    562 Post(s)
    Time Online
    118 d 6 h 45 m
    Avg. Time Online
    1 h 30 m
    Rep Power
    0
    Gamer IDs

    Gamertag: DarkByt3 PSN ID: raredaredevil
    Aww man this is what they make u learn in school? This is so basic...

    Just split each letter of the string into a array and loop the array. For every letter have a integer that increases +1 when it hits 14 there should be a space , reset the counter back to 0 and continue looping.


    Infact lets get creative?

    Why not use the split function on (" ") this will split the string into an array at every space so ur array would be like

    key1- 3.95
    key2-0.37
    key3-0.483.94

    Now we can loop the above array keys and check its length using string.length function (w.e it is). If the key length is > 4 then we need to recreate the current key with a space after the 4th letter , else its fine and move on.... Maybe you can get extra points or something like that I think it would be cleaner and you may just get noted for thinking differently (even though you didn't really)
    Last edited by DarkByte; 06-06-2013 at 12:39 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •