# Thread: SImple code, need help

1. ## SImple code, need help

Hey everyone,
Just started really getting into C++ and i need a bit of help with a code:

Code:
```#include <iostream>
#include <stdlib.h>
#include <string.h>

#define lastQuestion 4

const int subtraction = 2;
const int multiply = 3;
const int division = 4;

void askQuestion(int one, int two, int three, int x)
{

switch (x)
{
cout << one << " + " << two << " = ";
break;
case subtraction:
cout << one << " - " << two << " = ";
break;
case multiply:
cout << one << " * " << two << " = ";
break;
case division:
cout << one << " / " << two << " = ";
break;

}

cin >> input;

cout << "You are right!" << endl;
else
cout << "You are wrong, the right answer is " << answer << endl;

}

int main(int argc, char *argv[])
{
int one[lastQuestion], two[lastQuestion],three[lastQuestion], x[lastQuestion];

one[1] = 8; two[1] = 3; x[1] = addition;
one[2] = 4; two[2] = 2; x[2] = subtraction;
one[3] = -3; two[3] = -3; x[3] = multiply;
one[4] = 15; two[2] = 5; x[2] = subtraction;

for(int i = 1; i <= lastQuestion; i++)

system("PAUSE");
return 0;
}```
The program allows you to answer 3 math problems, but when I add the fourth, it skips over it. Any help is appreciated.

2. arrays are numbered 0 to but not includeing lastQuestion
Code:
```  one[0] = 8; two[0] = 3; x[0] = addition;
one[1] = 4; two[1] = 2; x[1] = subtraction;
one[2] = -3; two[2] = -3; x[2] = multiply;
one[3] = 15; two[3] = 5; x[3] = subtraction;

for(int i = 0; i <  lastQuestion; i++)```

3. one [4] has bounds 0 - 3, not 1 - 4

4. Thanks, I got it working.