Arduino Mega 2560 not returning expected values.

I'm working on interfacing the OSEPP Adruino Mega 2560 V3 to my PC, but I'm getting a few issues along the way.

The main issue I would like to focus on is that I'm getting the wrong values returned in the example:

int incomingByte = 0;   // for incoming serial data

void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte, DEC);
        }
}

I enter "6" and get something like "I received: 50". And similar stuff happens for other numbers. If it's two digits, I receive two values.

In the case of a C++ program I'm writing, I can sometimes send values up to 1500 and it won't fail. If I reflash, my max number is randomized again to something like 800.

Okay, so I discovered it's because it's sending it as ASCII-encoded data. I'm reading up on how to deal with this data, if anyone wants to chime in with their own ideas.

I'm reading up on how to deal with this data, if anyone wants to chime in with their own ideas.

Why are you explicitly using an int to store the character? Why are you explicitly using the DEC second argument?