I am doing an assignment that has to use a class dayType.
The program has to set the day, print the day and return the next day.
I am receiving the error:
--------------------Configuration: Program9 - Win32 Debug--------------------
Compiling...
Program9.cpp
C:\Documents and Settings\Faculdade\ISM3232\Assig9\Program9\Program9.cpp(45) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.
Program9.exe - 1 error(s), 0 warning(s)
Can somebody help me please ?
I am reading the book 100 times but can figure out what is happening.
Thanks a lot
#include <iostream>
#include <string>
using namespace std;
class dayType
{
public:
void setDay(char day);
void nextDay();
void printDay() const;
private:
string dayofweek[7];
int current;
char userEntry;
};
int main();
{
dayType myDay;
char day;
cout << "Please enter M for Monday, T for Tuesday, W for Wednesday" << endl;
cout << "R for Thursday, F for Friday, S for Saturday or U for Sunday" << endl;
cout << endl;
cin >> day;
myDay.setDay(day); // set the day
cout << endl;
myDay.printDay() const; // print the day
cout << endl;
myDay.nextDay(); // return the next day
cout << endl;
cout << myDay.printDay() << endl;
return 0;
} // end of main
void dayType::setDay(char day)
{
if (day = "m" || "M")
{
(dayofweek [0] == "MONDAY");
current = 1;
userEntry = day;
}
if (day = "t" || "T")
{
(dayofweek [1] == "TUESDAY");
current = 2;
userEntry = day;
}
if (day = "w" || "W")
{
(dayofweek [2] == "WEDNESDAY");
current = 3;
userEntry = day;
}
if (day = "r" || "R")
{
(dayofweek [3] == "THURSDAY");
current = 4;
userEntry = day;
}
if (day = "f" || "F")
{
(dayofweek [4] == "FRIDAY");
current = 5;
userEntry = day;
}
if (day = "s" || "S")
{
(dayofweek [5] == "SATURDAY");
current = 6;
userEntry = day;
}
if (day = "u" || "U")
{
(dayofweek [6] == "SUNDAY");
current = 7;
userEntry = day;
}
}
void dayType::nextDay()
{
{
current++;
if (current = 7)
current = 0;
}
{
current++;
if (current = 6)
current = 7;
}
{
current++;
if (current = 5)
current = 6;
}
{
current++;
if (current = 4)
current = 5;
}
{
current++;
if (current = 3)
current = 4;
}
{
current++;
if (current = 2)
current = 3;
}
{
current++;
if (current = 1)
current = 2;
}
}
void dayType::printDay() const
{
cout << "The day is: " << dayofweek << endl;
printDay();
}