Question: My program is returning 0 for the solutions. Can someone let me know where I went wrong or what I am missing? Programming in C++

My program is returning 0 for the solutions. Can someone let me know where I went wrong or what I am missing? Programming in C++
Thank you,
#include
#include
using namespace std;
int main ()
//Author: Amy M. Walsh
//A program that uses a function called Average ( ) that reads an unspecified number of integers and determines
//how many positive and negative numbers were entered, and calculates a total and an average of all entered values.
{
int sum = 0;
int negative = 0;
int num = 0;
int positive = 0;
double average = 0;
cout
cin >> num;
cout
if (num%10 >= 0
{
while (num/=10)
cout
{
num/=10;
if (num%10 > 0)
{
positive++;
}
else if (num%10 , 0)
{
negative++;
}
sum += num ;
}
average = (double) sum/(positive+negative);
}
cout
cout
cout
cout
return 0;
}
 My program is returning 0 for the solutions. Can someone let
Function Called Average.cpp View Search Project Build Debug Fortran wxSmith Tools Tools+ Plugins DoxyBlocks Settings Help CAUsers Aarons Documents Programming)amwalsh bin Debug)amwalsh.exe Enter a nunber. the input ends if it is 0:5 The nunber of positive integers are 0 The number of negative integers are 0 The total is 0 The average is nan Process returned 0 0x0) execution tine : 2.244 s Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!