Firstly, use int main() instead of void main() and <iostream> as opposed to <iostream.h>. Plenty of debate / explanations on this forum - just search for it and you'll strike gold.
Your program is probably crashing because your accessing outside of your array's boundaries -
1 2 3
|
int a[10];
for (i = 1; i <= 10; i++)
cin >> a[i];
|
You try to access a[1], which is good, but then as the loop progresses, you try to access a[10] because the for loop condition is still not fulfilled (i <= 10) and you will access a[10] which is outside of your array's boundaries. Remember when you declare an array it goes from 0 to n - 1 and in your case, these would be valid:
a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]