Error after task perform

I've written this as a revision and although the program works but at the end of the program, a error windows pop up. I was wondering what is wrong but i couldn't find out. Anyone kind enough to point it out?
Thanks in advanced


#include <iostream.h>

int Difference(int []);

int main(){
int intarr[9],x=10;


for (int count=0;count<10;count++){
cout<<"Please enter a number to be entered into the array ("<<x<<" more to be entered) : ";
cin>>intarr[count];
x--;
}

cout<<"The difference between the sum of all values from cell 0 to 4 and the sum from cell 5 to 9 is "<<Difference(intarr)<<endl;

return 0;
}

int Difference(int intarr[9]){
int diff=0,set1=0,set2=0;

set1=intarr[0]+intarr[1]+intarr[2]+intarr[3]+intarr[4];
set2=intarr[5]+intarr[6]+intarr[7]+intarr[8]+intarr[9];

if (set1>set2)
diff=set1-set2;
else diff=set2-set1;


return diff;
}
What is the error message?
closed account (z05DSL3A)
int intarr[9] should be int intarr[10]
and
int Difference(int intarr[9]){ should be int Difference(int intarr[]){


p.s. To post code use the [code] [/code] tags.
Last edited on
mcleano : it's almost like a error message when a program crashed.

Grey Wolf : Thanks for the point out, Grey Wolf. I'll remember that part.

Topic archived. No new replies allowed.