Need Some Help

Discussion in 'Programming General' started by wtp, Mar 29, 2011.

Need Some Help
  1. Unread #1 - Mar 29, 2011 at 9:39 PM
  2. wtp
    Joined:
    Nov 25, 2005
    Posts:
    2,455
    Referrals:
    2
    Sythe Gold:
    0

    wtp Grand Master
    Banned

    Need Some Help

    Hey guys. I'm trying to do a programming lab for school.

    [​IMG]

    How do I separate a number like 3456 to 3 4 5 and 6? I looked everywhere, but I can't find the answer, it's probably very simple.
     
  3. Unread #2 - Mar 30, 2011 at 12:00 AM
  4. The Black Tux
    Joined:
    Apr 19, 2009
    Posts:
    10,306
    Referrals:
    30
    Sythe Gold:
    55
    Vouch Thread:
    Click Here
    Two Factor Authentication User Cool Kid Former OMM Cook RsProd Sythe Awards 2012 Winner Village Drunk

    The Black Tux Veteran
    The Black Tux Donor Java Programmers PHP Programmers

    Need Some Help

    divide string into char array, create new string, for each char do space...
     
  5. Unread #3 - Mar 30, 2011 at 12:02 PM
  6. wtp
    Joined:
    Nov 25, 2005
    Posts:
    2,455
    Referrals:
    2
    Sythe Gold:
    0

    wtp Grand Master
    Banned

    Need Some Help

    Which code would I use to create an array?
     
  7. Unread #4 - Mar 30, 2011 at 7:14 PM
  8. AleZ
    Joined:
    Mar 2, 2011
    Posts:
    89
    Referrals:
    0
    Sythe Gold:
    0

    AleZ Member
    Banned

    Need Some Help

    You can use the regex split() and Integer valueOf() along with the scanner.

    scan for input (input example: 1 2 3 4)
    String numbers[] = input.split(" ");
    convert to int using valueOf
    add ints together to get sum.

    Have fun!
     
< NEED Help making a Bot. | Trouble developing a User Control - HELP! >

Users viewing this thread
1 guest


 
 
Adblock breaks this site