I am tying to display how many numbers the user entered and my program is like this:
#include <iostream>
using namespace std;
void getInput(double);
//**************** main function ****************************
int main()
{
cout << "This program count how many negative numbers you enter. \nThere will be three sections. \nEnter 0 to end a section." <<endl<<endl;
I'm really tired, so I'm sorry if my answer is wrong, but it looks like you define getInput() to pass a function, but when you call the function, you don't pass anything to it. IOW, you have to put count in the parenthesis when you call the function in main(). You are going have to declare count as a variable, too. You are also missing a "{" in your if statement.
yes, now it displays this:
//***************** count function *********************
int getInput()
{
double number; //hold number entered by the user
int count = 0;
//get input
do
{
cout << "Enter a number: ";
cin >> number;
//count positive number
if (number < 0)
count ++;
} while (number !=0);