Declare an array of floating point elements called week that can be referenced by using any day of the week as a subscript assume sunday is the first.
Okay. Just need a heads up here. I assume this means I am supposed to just set up a floating point array like
week[0.0,2.0,3.0, 4.0,5.0,6.0]
then just set up a switch for each case like
switch(week){
case 1 =0
etc.
etc.
#include <iostream>
usingnamespace std;
int main()
{
enum DayOfWeek { Su, Mo, Tu, We, Th, Fr, Sa };
constint N = Sa + 1;
week[N] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; // error week is undefined
DayOfWeek currentDay; // what does this do? Does it plug current day into dayofweek?
switch ( currentDay )
{
case Su:
week[Su] = 0.0;
break;
case Mo:
week[Mo] = 1.0;
break;
case Tu:
week[Tu] = 2.0;
break;
case We:
week[We] = 3.0;
break;
case Th:
week[Th] = 4.0;
break;
case Fr:
week[Fr] = 5.0;
break;
case Sa:
week[Sa] = 6.0;
break;
default:
std::cout << "Invalid day of week\n";
break;
}
}
Ok so does that look right? I have a few questions in the comments. How do you defind week[N]. Also What does DayofWeek current day do?
Thanks.