Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <conio.h>
- #include <iostream>
- using namespace std;
- int sumRange(int *start, int *end)
- {
- int answer = 0;
- while(start != end)
- {
- answer += *start;
- start++;
- }
- return answer;
- }
- int main()
- {
- const int SIZE = 5;
- int array[SIZE];
- for(int i = 0; i < 5; i++)
- cin >> array[i];
- cout << sumRange(array, array + SIZE);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment