### Newb Array

I'm in an online "intro" to programming class, and for my assignments my prof. gives us the psuedocode and then expects us to convert it to c++ statements. He doesn't give as any tips and is very hard to get in touch with. For this assignment we are supposed to create a program that allows the user to enter 15 numbers, then displays each number and it's difference from the numeric average of the numbers entered. I have errors in lines 63 and 68, there may be more you can spot however... In line 63 i must be declared and I have no idea htf I should do that. And in 68 I am missing a primary expression before else, and a ";" before it. Here is my code so far, any pointers are greatly appreciated;
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869`` ``````// Start // Declarations // num SIZE = 15 // num numbers[SIZE] // num counter = 0 // num total = 0 // num average = 0 // num diffFromAvg = 0 // num SENTINEL = -1 // // output "Please enter a positive number: " // input numbers[counter] // while ((counter < 15) AND (numbers[counter] <> SENTINEL)) // counter = counter + 1 // total = total + numbers[counter] // output "Please enter a positive number: " // input numbers[counter] // endwhile // if (counter > 0) then // average = total/counter // for i = 0 to counter - 1 // diffFromAvg = numbers[i] - average // output "Number[",i,"]: ",numbers[i]," Difference from Average is ",diffFromAvg // endfor // else // output "Processing incomplete. No values in the array." // endif // Stop #include #include using namespace std; int main() { int SIZE=15; int numbers[SIZE]; int counter=0; double total=0; double average=0; double diffFromAvg=0; int SENTINEL=-1; cout<<"Please enter a positive number: "<>numbers[counter]; while((counter<15)&&(numbers[counter]!=SENTINEL)) { counter=counter+1; total=total+numbers[counter]; cout<<"Please enter a positive integer: "<>numbers[counter]; } if(counter>0) { average=total/counter; } for(i==0; counter-1;) { diffFromAvg=numbers[i]-average; cout<<"Number[",i,"]: "<

Also, if you think I should change the structure, let me know. I have a hard time teaching myself things v.v
try the following
1) Replace line no. 58 with :-
`for(int i==0; counter-1;)`

2)replace line number 61 with
`cout<<"Number["<<i<<"]: "<<numbers[i]<<"Difference from Average is "<<diffFromAvg<<endl;`

enjoy programming :)
Topic archived. No new replies allowed.