I have tried the two ways below to get my functions to call and run, but VS gives me the error
error c2660: ..... function does not take 0 arguments
First way tried
//Michelle CSI 130 Lab 11 Part 2 Section B
//Digital logic and Boolean algebra
#include <iostream>
using namespace std;
int count (int I, int N)
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a running count, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Number count.
I=0, N=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> N;
N=N;
I=I+1;
while (N>=0)
{ cin >> N;
N=N;
I=I+1;
}
return I;
}
int avg (int i, int n, int avg, int sum)
{//PURPOSE: Allows the user to enter as many numbers as they like, it keeps a running count and average, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Number average.
i=0, n=0, avg=0, sum=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> n;
sum=n;
i=i+1;
while (n>=0)
{ cin >> n;
sum=sum+n;
i=i+1;
avg=sum/i;
}
return avg;
}
int Highest (int n, int large)
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of highest number, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Highest number.
n=0, large=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> n;
large=n;
while (n>=0)
{ cin >> n;
while (n>large)
{ large=n;
}
}
return large;
}
int Lowest (int n, int low)
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of lowest number, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Lowest number.
n=0, low=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> n;
low=n;
while (n>=0)
{ cin >> n;
while (n<low)
{ low=n;
}
}
return low;
}
int main()
{//PURPOSE: Allows the user to enter their choice of which calculation they would like to make of the numbers they enter.
//INPUT: Users choice and stored in Choice.
//OUTPUT: None.
int Choice;
cout << "Please choose an option\n" << "1. Count the number of entries.\n" << "2. Calculate the average.\n" << "3. Determine the highest number.\n" << "4. Determine the lowest number.\n";
cin >> Choice;
if (Choice==1)
{ cout << count();
}
else if(Choice==2)
{ cout << avg();
}
else if (Choice==3)
{ cout << Highest();
}
else
{ cout << Lowest();
}
return 0;
}
second way tried
#include <iostream>
using namespace std;
void count (int I, int N)
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a running count, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Number count.
I=0, N=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> N;
N=N;
I=I+1;
while (N>=0)
{ cin >> N;
N=N;
I=I+1;
}
cout << "Number count is: " << I;
}
void avg (int i, int n, int avg, int sum)
{//PURPOSE: Allows the user to enter as many numbers as they like, it keeps a running count and average, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Number average.
i=0, n=0, avg=0, sum=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> n;
sum=n;
i=i+1;
while (n>=0)
{ cin >> n;
sum=sum+n;
i=i+1;
avg=sum/i;
}
cout << "Number average is: " << avg;
}
void Highest (int n, int large)
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of highest number, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Highest number.
n=0, large=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> n;
large=n;
while (n>=0)
{ cin >> n;
while (n>large)
{ large=n;
}
}
cout << "Largest number is: " << large;
}
void Lowest (int n, int low)
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of lowest number, till they end with -1.
//INPUT: Number will be entered one at a time and stored in n.
//OUTPUT: Lowest number.
n=0, low=0;
cout << "Enter positive numbers one at a time.\n" << "When complete enter -1.\n";
cin >> n;
low=n;
while (n>=0)
{ cin >> n;
while (n<low)
{ low=n;
}
}
cout << "Smallest number is: " << low;
}
int main()
{//PURPOSE: Allows the user to enter their choice of which calculation they would like to make of the numbers they enter.
//INPUT: Users choice and stored in Choice.
//OUTPUT: None.
int Choice;
cout << "Please choose an option\n" << "1. Count the number of entries.\n" << "2. Calculate the average.\n" << "3. Determine the highest number.\n" << "4. Determine the lowest number.\n";
cin >> Choice;
if (Choice==1)
{ count();
}
else if(Choice==2)
{ avg();
}
else if (Choice==3)
{ Highest();
}
else
{ Lowest();
}
return 0;
}
Any help is appreciated.