I am trying to write a program that will let a user enter three numbers and the program will count how many positive number the user entered
#include <iostream>
int enterInteger()
{
int a, b, c{};
std::cout << "Enter your interger: ";
std::cin >> a;
std::cout << "Enter your interger: ";
std::cin >> b;
std::cout << "Enter your interger: ";
std::cin >> c;
return a, b, c;
}
void if_fun(int a, int b, int c, int counter)
{
if (a > 0)
std::cout << "InProgress " << counter + 1 << std::endl;
if (b > 0)
std::cout << "InProgress " << counter + 1 << std::endl;
if (c > 0)
std::cout << "InProgress " << counter + 1 << std::endl;
}
int main()
{
int num{ enterInteger() };
if_fun(num);
}
When I try to compile the code, I receive the following erros:
Error (active) E0165 too few arguments in function call Iflesson
Error C2660 'if_fun': function does not take 1 arguments Iflesson
I tried to initiate arguments in if_fun
int main()
{
int num{ enterInteger() };
if_fun(num1, num2, num3, 4);
}
As expected, there are erros about undefined arguments. So in function
if_fun()
the programm add 1 integer to agrument counter
and it should be the total amount of positive numbers
So, I am stuck with solution and can not recognize how I should change my code to work it as I thought