1. ## Help with array

I have this code and I am trying to make it look like this:
Code:
```How many values are you going to enter (5-25)? 30
Too many values; try again.
How many values are you going to enter (5-25)? 2
Too few values; try again.
How many values are you going to enter (5-25)? 8

I can get the first part as in how many values you want to enter which i can get until I add the next part into it which is Please enter value. When I add this is a for loop it messes it up.

This is my code when I just add the first part
Code:
```
numEntered = 0;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
while (numEntered < 5 || numEntered > 25 ) {
if (numEntered < 5) {
cout << "To Few values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
else if (numEntered > 25) {
cout << "To many values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}```
and this is what i get:
Code:
```How many values are you going to enter (5-25)30
To many values; try again
How many values are you going to enter (5-25)2
To Few values; try again
How many values are you going to enter (5-25)8```
This on top looks good but when i add the next part, it misses up:
This is my new code:
Code:
```numEntered = 0;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
while (numEntered < 5 || numEntered > 25 ) {
if (numEntered < 5) {
cout << "To Few values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
else if (numEntered > 25) {
cout << "To many values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}

for (i=1; i <= numEntered; i++) {
cout << "Please enter value " << i <<  ": ";
cin >> A[i];
}```
It makes it look like this:

Code:
```How many values are you going to enter (5-25)30
To many values; try again
How many values are you going to enter (5-25)2
To Few values; try again
How many values are you going to enter (5-25)To Few values; try again
How many values are you going to enter (5-25)7.6
Can you tell me what I am doing wrong

3. You are missing a brace to close the while loop. If you indented your code correctly you would have saw that.

4. Ok I fixed the brace but still not luck

5. What's your new correctly indented code?

6. Code:
```numEntered = 0;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
while (numEntered < 5 || numEntered > 25 ) {
if (numEntered < 5) {
cout << "To Few values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
else if (numEntered > 25) {
cout << "To many values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
}

cout << endl << endl;```
This part works right for what I want it to do but when I add the rest of it, it screws up. I don't know what I am doing wrong? It is only a little mistake but it adds another output.

Code:
```
numEntered = 0;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
while (numEntered < 5 || numEntered > 25 ) {
if (numEntered < 5) {
cout << "To Few values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
else if (numEntered > 25) {
cout << "To many values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
}

cout << endl << endl;

for (j=0; j <= numEntered; j++){
cout << "Please enter value ";
cin >> A[j];
}```
This above code looks like this:

Code:
```How many values are you going to enter (5-25)30
To many values; try again
How many values are you going to enter (5-25)2
To Few values; try again
How many values are you going to enter (5-25)8

7. Ok guys I did it,I just changed j =1

8. but now I am trying to find the average and sum and also the average of numbers over 100.

9. This is my new code but for some reason it gives me an outrageous number for sum
Code:
``` numEntered = 0;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
while (numEntered < 5 || numEntered > 25 ) {
if (numEntered < 5) {
cout << "To Few values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
else if (numEntered > 25) {
cout << "To many values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
}

cout << endl << endl;

for (j=1; j <= numEntered; j++){
cout << "Please enter value ";
cin >> A[j];
}

cout << endl << endl;

sum = 0.0;
for (j=0; j < 10; j++) {
sum += A[j];
}

cout << "The sum is " << sum;```

10. correctly indented
If you aren't willing to spend a few seconds fixing your indentation and make your code a lot easier to read, why should we spend our time helping you?

11. Is this better?
Code:
```numEntered = 0;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;

while (numEntered < 5 || numEntered > 25 ) {

if (numEntered < 5) {
cout << "To Few values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}

else if (numEntered > 25) {
cout << "To many values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}
}

cout << endl << endl;

for (j=1; j <= numEntered; j++){
cout << "Please enter value ";
cin >> A[j];
}

cout << endl << endl;

sum = 0.0;
for (j=0; j < numEntered; j++) {
sum = sum + A[j];
}

cout << "The sum is " << sum;```

12. Code:
```numEntered = 0;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;

while (numEntered < 5 || numEntered > 25 ) {

if (numEntered < 5) {
cout << "To Few values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}

else if (numEntered > 25) {
cout << "To many values; try again" << endl;
cout << "How many values are you going to enter (5-25)";
cin >> numEntered;
}

}

cout << endl << endl;

for (j=1; j <= numEntered; j++){
cout << "Please enter value ";
cin >> A[j];
}

cout << endl << endl;

sum = 0.0;
for (j=0; j < numEntered; j++) {
sum = sum + A[j];
}```

13. Anyways since you corrected the "indention" why is my sum not working right?

14. What is your input? What is the output? What is the expected output?

15. This is what is wrong:
Code:
```How many values are you going to enter (5-25)30
To many values; try again
How many values are you going to enter (5-25)2
To Few values; try again
How many values are you going to enter (5-25)8