Array

Can someone help me?

This is the problem (sorry) Just a beginner and still learning more.

Complete the program below by defining the functions called within the main function. Do not edit the main function and
follow the flow of the sample dialogue below.

#include <iostream>
using namespace std;
int main(){
int size;
askNum(size); //ask a positive number for size from the user, accept only a positive number
int arrNum[size]; //this creates an array with size as the number of elements
askArrayValues(arrNum,size); //ask values from the user to be stored in the array,
//users can input positive or negative values
countDispNegativeValues(arrNum,size); //count and display all negative numbers in the array
countDispPositiveValues(arrNum,size); //count and display all positive numbers in the array
return 0;
}

---------------------------------------------------
SAMPLE DIALOGUE
Type a positive, nonzero number: -6
Type a positive, nonzero number: 0
Type a positive, nonzero number: 5
Type 5 numbers: 1 2 -3 4 -5
There are 2 negative numbers: -3 -5
There are 3 positive numbers: 1 2 4
---------------------------------------------------
To be honest you're probably best off going through some tutorials on this website. If you get stuck post some of your code (in code tags) and ask some more specific questions.

Look at:
http://www.cplusplus.com/doc/tutorial/basic_io/ (getting user input)
http://www.cplusplus.com/doc/tutorial/arrays/ (arrays)
http://www.cplusplus.com/doc/tutorial/functions/ (functions)

seeing as you're a beginner I wouldn't initially bother putting stuff into functions, just lump it all in main() to start with to make sure your logic is correct.

Last edited on
Topic archived. No new replies allowed.