reading numbers in an array and placing the positive and negative integers in place

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
[code]im not understanding how to do this im reslly lost any help would mean alot
Write a C++ program that reads the numbers in an array of integers and places all zero and positive integers in an array named positive and all negative numbers in an array named negative.
1.The number of elements in the array is 10.
2.Include a function to initialize the array by asking the user to enter 10 integers. The parameter passed to the function is the array of integers.
3.Include a second function to initialize both the positive and the negative arrays to zero. The parameters passed to the function are both arrays.
4.Include a third function to place the numbers entered in the positive or negative array. The parameters passed to the function are both arrays.
5.Include a fourth function to display the values in both the positive and the negative arrays. The parameters passed to the function are both arrays.

[code]
#include<iostream>
#include<string>

using namespace std;

int initialization (int []);
int identifying (int []);
const int num = 10;
int main()
{
  int num[10];
  initialization (num);
}

int initialization (int getNum [])
{
  for(int s = 0; s < num ; s ++)
    {

      cout <<" Please enter a number : # " << (s+1) << " = " << endl;
      cin >>getNum[s];
 identifying (getNum);

}
int identifying (int findNum [])
{


  for (int i=0; i < num ; i++)
    {
      if (findNum[i] >= 0)
        {
          cout <<"The positive number are " << findNum[i] << endl;

        }
      else
        {
          cout <<"The Negative number are " << findNum[i] << endl;

        }
    }
 return 0;
}





 
[/code][/code]
Last edited on
does this seem better I ran it and worked but can I get some advice if it seems right I would appreciate it keskiverto
Topic archived. No new replies allowed.