I am doing an assignment that is for the days of the week. This is what I am supposed to do, STEP 1: Create the Project and Main Class
1. Create a new console application project and name it "Week1Lab_YourName".
2. Create a new class called DayOfTheWeek. The class should have a data member that can store the day of the week, such as Mon for Monday, Tues for Tuesday, and so on.
STEP 2: Create the Member Functions
1. Create the necessary member functions that will perform the required operations outlined in the lab summary above.
Call these functions setDay(), printDay(), and getDay().
Function setDay(string) takes a string parameter (for example, Monday, Tuesday, etc.) and stores the value in the day attribute.
Function printDay() prints the value of the day attribute on console output.
Function getDay() returns the value of the day attribute.
STEP 3: Create a Main() Program
1. Write a main program that will instantiate two objects of the class DayOfTheWeek. Use these objects to test the various operations on this class, using the examples in the lectures and reading to perform the required operations.
STEP 4: Build and Test
1. Build your project (compile your program).
2. Eliminate all syntax errors.
3. Run the program.
4. Verify results of program execution and correct any logic errors discovered.
This is what I have:
If I build it I get: fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?Code:#include <string> #include "DayOfTheWeek.h" using std::string; class DayOfTheWeek { private: string day; public: void SetDay(string); void PrintDay(string); string GetDay(); }; MAIN #include <string> #include "DayOfTheWeek.h" using namespace std; int Main() { DayOfTheWeek day; day.GetDay ("mon"); cout << DayOfTheWeek.PrintDay << endl; } void DayOfTheWeek::SetDay(string day) { string Monday = "mon"; string Tuesday = "tues"; string Wednesday = "wed"; string Thursday = "thurs"; string Friday = "fri"; string Saturday = "sat"; string Sunday = "sun"; } void DayOfTheWeek::PrintDay(string day) { cout << "Today is " << day << endl; } string DayOfTheWeek::GetDay() { string day = "Monday"; return day; }
If I add the #include "stdafx.h" it tells me: fatal error C1083: Cannot open include file: 'DayOfTheWeek.h': No such file or directory
What am I doing wrong?