I almost have this working right....
The program itself basically runs ok, but I want to try to get it to display a customized statement based on the input data.
If there are >1 positive or negative value, the output statement should be in the plural form; if there is only 1 positive or negative value, the output should be singular. I put in the statements, but something is still wrong.
Here's the part of the program this pertains to:
Code:
int calculations()
{
int number;
int positiveValues;
int negativeValues;
for (int counter = 0; counter < 1; counter++)
{
positiveValues = 0;
negativeValues = 0;
do
{
cout << "Enter an integer (or zero to stop): ";
cin >> number;
if (number > 0)
{
positiveValues++;
}
else if (number < 0)
{
negativeValues++;
}
else
{
cout << endl;
}
} while (number != 0);
if(positiveValues = 1)
{
cout << "There was "
<< positiveValues
<< " positive value in your group of integers." << endl;
}
else if (negativeValues = -1)
{
cout << "There was "
<< negativeValues
<< " negative value in your group of integers." << endl;
}
else
cout << "There were "
<< positiveValues
<< " positive values in your group of integers." << endl;
cout << "There were "
<< negativeValues
<< " negative values in your group of integers." << endl << endl;
}
return 0;
}
any suggestions would be greatly appreciated.
Thanks!!