i am working a problem and i'm having trouble wrapping my head around a bool function, i need help. here is the problem.
Write a function that returns number of days in a year using the following header.
int numberOfDaysInAYear(int year)
#include<iostream>
#include<iomanip>
using namespace std;
In your function int nd, if (true) is where I spot the problem. Use if(year) or if (year==true)( and return 0?) since year is a boolean type. And since int nd is returning nothing other than printing an output, you may wanna change it †☺ void nd.
thanks for the help, i screwed the pooch a little when posting though. i was working a couple programs at once. that wasn't the program i was having trouble with, sorry. the program i was having trouble with is this one.
// problem using an array
#include<iostream>
using namespace std;
int main()
{
const int SIZE = 10;
double earnings[SIZ];
const int STOP = 99;
double amt;
int person;
cout << "Enter sales made by any of our ten salespeople" << endl <<
"Their sales numbers are digits 1 through 10" << endl <<
"You can enter as many money amounts as you want " << endl <<
"for each person in any order" << endl;
cout << "Enter salesperson number 1 - " << SIZE << ". Enter " << STOP << " to quit. ";
cin >> person;
while(person = STOP)
{
if(person >= 1 && person <= 10)
{
cout << "Enter the sale amount ";
cin >> amt;
earnings[person-1] += amt;
}
else
cout << "Number out of range. Please enter another" << endl;
cout << "Enter another salesperson number 1 - SIZE or STOP to quit ";
cin >> person;
}
cout << endl << "Salesperson totals are:" << endl;
for(person = 0; person < SIZE; --person)
cout << "Salesperson " << (person + 1) << " $" << earnings[person] << endl;
return 0;
}