declaration is incompatible with "std::string getDay(<error-type> d)" error help
Feb 22, 2018 at 1:55am UTC
when i introduce getDay at top it says : declaration is incompatible with "std::string getDay(<error-type> d)" declared at line 22
How can i get this error to go away? i have even tried #include <string> with the same result
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 40 41 42 43 44 45 46 47 48 49 50 51
#include <iostream>
using namespace std;
enum dayOfWeek {M = 1, TU, W, TH, F, SA, SN};
string getDay(dayOfweek);
int main()
{
dayOfWeek d = M;
cout << d << endl;
cout << getDay(M) << endl;
system("pause" );
return 0;
}
string getDay(dayOfweek d)
{
switch (d)
{
case M:
return "Monday" ;
case TU:
return "Tuesday" ;
case W:
return "Wednesday" ;
case TH:
return "Thursday" ;
case F:
return "Friday" ;
case SA:
return "Saturday" ;
case SN:
return "Sunday" ;
default "you typed wrong" ;
}
return string;
}
Last edited on Feb 22, 2018 at 2:00am UTC
Feb 22, 2018 at 7:38am UTC
Uppercase and lowercase are NOT the same.
Look VERY carefully at
dayOfWeek (lines 6, 11)
dayOfweek (lines 8, 22)
Topic archived. No new replies allowed.