1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#include <iostream>
enum month {jan,feb,mar,apr,jun,jul,aug,sep,oct,nov,dec};
enum weekday {sun,mon,tue,wed,thur,fri,sat};
int year;
int numberofdays(month);
void plusone7(weekday&);
int main()
{
int number = 0;
int suns = 0;
//Some code
std::cout << number << " days total." << std::endl;
weekday dayofweek;
for (int day = 1,dayofweek = mon;day<=number;day++,plusone7(dayofweek)) //"No matching function for call to plusone7"
{
if (dayofweek == sun)
{
suns++;
}
}
std::cout << suns << " is the number of sundays" << std::endl;
}
//Defines a few functions
void plusone7(weekday& added)
{
if (added == sat)
{
added = sun;
}
else
{
added++;
}
}
|