Search:

Type: Posts; User: Junky

Search: Search took 0.11 seconds.

  1. Replies
    3
    Views
    1,297

    Re: Error with String range print -1.

    You need to rework your if statements. All the other (- / %) are kinda on the right track but you are comparing each value returned from indexOf to pos. Get rid of pos and compare the returned value...
  2. Replies
    3
    Views
    1,297

    Re: Error with String range print -1.

    int pos = expr.indexOf("+");

    What happens when the user enters an expression that is not addition? The indexOf method returns -1 when it cannot find the target char.
Results 1 to 2 of 2