Hey everybody, I´m using Xcode with c++.

I´ve been trying to make a calculator, which works fine when I set it on "Debug".

Though when I set it on "Release", it gives me 1120 errors in "NSObjRuntime.h".

And this is my code:

Code:

int g_anArray[0];
int g_nArraySize;
#include <iostream>
int main()
{
int nOperator;
using namespace std;
cout << "This is a calculator capable of adding, subtracting, multiplying and dividing. It has a limit of 6 digits, which means answers over 6 digits will be displayed as an error(except dividing, which will result in the answer being rounded up at 6 digits)." << endl;
cout << "Enter an operator(1 for +, 2 for -, 3 for * and 4 for /) and press enter." << endl;
cout << "Or enter 5 if you want to add many numbers together.";
cin >> nOperator;
if (nOperator ==1) {
double x;
double y;
cout << "Enter a number, press enter, then enter a second number. These numbers will be added." ;
cin >> x;
cin >> y;
cout << "The answer is " << x + y << endl;
}
else if (nOperator ==2) {
double a;
double b;
cout << "Enter a number, press enter, then enter a second number. These numbers will be subtracted." ;
cin >> a;
cin >> b;
cout << "The answer is " << a - b << endl;
nSecondLoop = 1;
}
else if (nOperator ==3) {
double c;
double d;
cout << "Enter a number, press enter, then enter a second number. These numbers will be multiplied." ;
cin >> c;
cin >> d;
cout << "The answer is " << c * d << endl;
}
else if (nOperator ==4) {
float e;
float f;
cout << "Enter a number, press enter, then enter a second number. These numbers will be divided." ;
cin >> e;
cin >> f;
if (f == 0) {
cout << "Dividing by zero? Really...";
}
else {
cout << "The answer is " << e / f << endl;
}
else if (nOperator ==5) {
cout << "Enter how many numbers you want to add together. (Max 6)" << endl;
cin >> g_nArraySize;
#define ARRAY_SIZE g_nArraySize
#define int g_anArray[ARRAY_SIZE];
if (g_nArraySize <2) {
cout << "You can´t enter less than 2 numbers!" << endl;
}
else if (g_nArraySize > 6) {
cout << "No more than 10 numbers are accepted" << endl;
}
else if (g_nArraySize == 2) {
cout << "Enter the numbers. (Press enter between numbers)" << endl;
cin >> g_anArray[1];
cin >> g_anArray[2];
cout << "The answer is " << g_anArray[1] + g_anArray[2] << endl;
}
else if (g_nArraySize == 3) {
cout << "Enter the numbers. (Press enter between numbers)" << endl;
cin >> g_anArray[1];
cin >> g_anArray[2];
cin >> g_anArray[3];
cout << "The answer is " << g_anArray[1] + g_anArray[2] + g_anArray[3] << endl;
}
else if (g_nArraySize == 4) {
cout << "Enter the numbers. (Press enter between numbers)" << endl;
cin >> g_anArray[1];
cin >> g_anArray[2];
cin >> g_anArray[3];
cin >> g_anArray[4];
cout << "The answer is " << g_anArray[1] + g_anArray[2] + g_anArray[3] + g_anArray[4] << endl;
}
else if (g_nArraySize == 5) {
cout << "Enter the numbers. (Press enter between numbers)" << endl;
cin >> g_anArray[1];
cin >> g_anArray[2];
cin >> g_anArray[3];
cin >> g_anArray[4];
cin >> g_anArray[5];
cout << "The answer is " << g_anArray[1] + g_anArray[2] + g_anArray[3] + g_anArray[4]+ g_anArray[5] << endl;
}
else if (g_nArraySize == 6) {
cout << "Enter the numbers. (Press enter between numbers)" << endl;
cin >> g_anArray[1];
cin >> g_anArray[2];
cin >> g_anArray[3];
cin >> g_anArray[4];
cin >> g_anArray[5];
cin >> g_anArray[6];
cout << "The answer is " << g_anArray[1] + g_anArray[2] + g_anArray[3] + g_anArray[4]+ g_anArray[5] + g_anArray[6] << endl;
}
else {
cout << "Really, what DID you enter?";
}
else {
cout << "You entered an invalid operator." << endl;
}
return 0;
}

I dunno what this is, please help me!