Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int Split(int array_input[], int arraySize, int firstOutputArray[], int secondOutputArray[])
- {
- int positiveHits = 0;
- for (int i = 0; i < arraySize; i++)
- {
- if (array_input[i] >= 0)
- {
- firstOutputArray[i] = array_input[i];
- positiveHits++;
- }
- else
- {
- secondOutputArray[i] = array_input[i];
- }
- }
- return positiveHits;
- }
- int main()
- {
- int input_array[5] = { -2, 4, 6, 8, -10 };
- int first_output_array[5], second_output_array[5];
- int result = Split(input_array, 5, first_output_array, second_output_array);
- std::cout << "Number of positive integers in array: " << result << std::endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment