# C++ about function and array homework coding

 Jun Nishikawa · July 5, 2014 Hi I have been coding this homework for a while but Im quite new to it and not quite sure if this is correct or not. below is the question.A) Define an array with a maximum if 20 integer values, and fill the arrays with numbers input from the keyboard. Then write a function name split() that reads the array and places all zeroes or positive number in an array named "positive" and all negative number in an array named "negative" Finally have a program call a function that displays the values in both the positive and negative arrays.B) Extend the program written in part A to sort positive and negative arrays into ascending order before they're displayedMy Coding and Example of result below//  main.cpp//  ArrayPosNeg//  Created by DOLCE on 5/7/26 ????.//  Copyright (c) ???? 26 ????. All rights reserved.#include using namespace std;void split(int theArray[], int sizeOfArray);     //Function Phototype work for spliting Pos & Neg numberint main(){    int numberSet[20];        for (int i = 0 ; i < 20 ; i++)    {                cout << "Enter 20's value of integer (Except zero) : ";        cin >> numberSet;            }        split(numberSet, 20);            return 0;}void split(int theArray[], int sizeOfArray){    int pos[sizeOfArray];    int neg[sizeOfArray];        for (int x= 0 ; x < sizeOfArray ; x++)    {        if (theArray[x] >= 0)        {            pos[x] = theArray[x];            cout << "The group of Positive number is : " << pos[x] << endl;        }            }    cout << endl;        for (int y = 0 ; y < sizeOfArray ; y++)    {        if (theArray[y] < 0)        {            neg[y] = theArray[y];            cout << "The group of Negative number is : " << neg[y] << endl;        }            }}//Sorting Example (Beta)//Enter 20's value of integer (Except zero) : 2//Enter 20's value of integer (Except zero) : 424//Enter 20's value of integer (Except zero) : 52//Enter 20's value of integer (Except zero) : -12//Enter 20's value of integer (Except zero) : -41//Enter 20's value of integer (Except zero) : 0//Enter 20's value of integer (Except zero) : 1250//Enter 20's value of integer (Except zero) : 0//Enter 20's value of integer (Except zero) : 356//Enter 20's value of integer (Except zero) : 124//Enter 20's value of integer (Except zero) : -14//Enter 20's value of integer (Except zero) : 0//Enter 20's value of integer (Except zero) : -35//Enter 20's value of integer (Except zero) : -23//Enter 20's value of integer (Except zero) : -5//Enter 20's value of integer (Except zero) : 2//Enter 20's value of integer (Except zero) : 4//Enter 20's value of integer (Except zero) : 0//Enter 20's value of integer (Except zero) : 6//Enter 20's value of integer (Except zero) : 3//The group of Positive number is : 2//The group of Positive number is : 424//The group of Positive number is : 52//The group of Positive number is : 1250//The group of Positive number is : 356//The group of Positive number is : 124//The group of Positive number is : 2//The group of Positive number is : 4//The group of Positive number is : 6//The group of Positive number is : 3//The group of Negative number is : -12//The group of Negative number is : -41//The group of Negative number is : -14//The group of Negative number is : -35//The group of Negative number is : -23//The group of Negative number is : -5//Zero Value0//Zero Value0//Zero Value0//Zero Value0//program ended with exit code: 0PS. so what I am really confuse what to do is the part "B" and part "A" if anyone knows what I have done wrong here feel free to correct me, this is my first C++ class I have ever taken in my life and I am still new to this web board so nice to meet you guys ! ^^/

## Replies

Nothing to see here.

## C++

129,764 followers