Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Integer Array
- int billy[] = {16, 2, 77, 40, 12071};
- // Calculates number of integers in the array
- int sizeofarray = sizeof (billy) / sizeof (billy[0]);
- void ArrayTotal (int a[])
- {
- cout << "The contents of the array are, ";
- int result = 0;
- for (int n = 0; n < sizeofarray; n++) {
- cout << a[n] << ", ";
- result += a[n];
- }
- cout << newline;
- cout << "The total of the array is " << result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement