jonsca, in C++ you don't need the implicit character conversion involved with [B]'\0'[/B], you just need [B]0[/B].

Is that the only way to go?
I have no idea. I've never had the need.
[CODE]
string[offset] -= 1;
[/CODE]

Could you cut the code down to 20 or 30 lines? The least amount of code which replicates the problem. Also could you use white space indentation? People tend to respond to posts which are easy on the eyes and short.

[QUOTE][CODE]~Card(hearts[1]);//I am not sure if this is even right[/CODE][/QUOTE]
It's not. Destructors take no arguments and are called automatically. They should also be virtual whenever the object might be polymorphic.

I read about a coding style where not one variable is changed. Everything must stay constant. I don't remember what it's called, but it's the bomb. I never realized this little project would be [I]so easy[/I].

Here is a 98 line calculator that supports [B]()^*/+-[/B]. If you find a bug, please don't hesitate to comment. It doesn't handle invalid input well and forgets to loop, keeping the code short. You'll get a bunch of debug output and the result should be after RESULT.

Now to the main question: Did I do this right?
Other questions: Could anything be better? Is there anything wrong with it?
[CODE]package jcalculator;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final String line = scanner.nextLine();
    System.out.println("RESULT: "+parentheses(line));
}

static String parentheses(final String arg)
{
    System.out.println("parent: "+arg);
    if (arg.indexOf('(') < 0) return ""+math(arg);
    final int offset0 = arg.lastIndexOf("(");
    final int offset1 = next_of(offset0, arg, ')', +1);
    try {
        if (arg.charAt(offset0-1) != '*')
            return parentheses(arg.substring(0, offset0) +
                    "*" +
                    arg.substring(offset0));
    } catch (Exception e) {} // EOL
    try {
        if (arg.charAt(offset1+1) != '*')
            return parentheses(arg.substring(0, offset1+1) +
                    "*" +
                    arg.substring(offset1+1));
    } catch (Exception e) {} // EOL
    return parentheses(arg.substring(0, offset0) +
            math(arg.substring(offset0+1, offset1)) +
            arg.substring(offset1+1));
}

static int next_of(
        final int ret,
        final String string,
        final char find_char,
        final int increment)
{
    if (string.charAt(ret) != find_char)
        return next_of(ret+increment, string, find_char, increment);
    else return ret;
}

static int last_integer(
        final int ret,
        final String string,
        final int increment)
{ ...
quuba commented: Your parser is fantastic. Perfect for breaking the head. +3

[CODE]for (i = 0; i < a.length(); i++)
if ((a[i] >= 'A' && a[i] <= 'Z') || (a[i] >= 'a' && a[i] <= 'z'))[/CODE]
:)

Did edit.

vedro-compota commented: +++++ +1

Do you mean recursively? That's the entry-point for the entire Java Application. I don't see why you couldn't call main() from main(), but a function call requires something to dereference (something to point at. What alone are you trying to call? The entire App?
I apologize for not entirely understanding your question. Will you word it differently?

[QUOTE=Transcendent;1416168]I don't know how to call this method [B]to[/B] another program. [/QUOTE]
Do you mean [B]from[/B] another program? If so what language is the other program written in? Usually a system call works but that's not the Java way.

[CODE]from random import randint

array = [randint(0, 30) for i in range(15)]
print (array)
for i in range(15):
if array[i] < 15: array[i] = 0
print (array)[/CODE]