hi this is the second question I have...the teacher has asked us to embed the code in the algorithm he wrote... im not really sure what im doing but here it is...what should i do different?.. thank you so much
// Start
#include <iostream>
#include <cstdlib>
using namespace std;
int main( )
{
// Declarations
// num SIZE = 15
// num numbers[SIZE]
// num counter = 0
// num total = 0
// num average = 0
// num diffFromAvg = 0
// num SENTINEL = -1
Const int SIZE = 15;
Int numbers[SIZE];
Int counter = 0;
Int total = 0;
Int average=0;
Int diffFromAvg=0;
Int SENTINEL = -1;
//
// output "Please enter a positive number: "
// input numbers[counter]
cout << “Please enter a positive number: “ = << positiveNumber << endl;
cin>>numbers[counter];
// while ((counter < SIZE) AND (numbers[counter] <> SENTINEL))
// total = total + numbers[counter]
// counter = counter + 1
// output "Please enter a positive number: "
// input numbers[counter]
// endwhile
while ((counter<SIZE)&&(numbers[counter]<>SENTINEL))
{
Total=total+numbers[counter];
Conter=counter+1;
cout << “Please enter a positive number: “ = << positiveNumber << endl;
cin>>numbers[counter];
}
// if (counter > 0) then
// average = total/counter
// for i = 0 to counter - 1
// diffFromAvg = numbers[i] – average
If(counter>0)
{
Then
Average=total/counter;
For(i=0;counter-1;++)
{
differentFromAvg=numbers[i]-average
// output "Number[",i,"]: ",numbers[i]," Difference from Average is ",diffFromAvg
// endfor
// else
// output "Processing incomplete. No values in the array."
// endif
cout << “Number[“,I”]: “,numbers[i],” Difference from Average is = “ <<diffFromAvg << endl;
}
Else
cout << “Processing incomplete. No values in the array“ = << processingIncomplete << endl;
}