Question: for the following code I need the source code and output screenshot (includes date/time) in a PDF format. I keep getting an error for the
for the following code I need the source code and output screenshot (includes date/time) in a PDF format. I keep getting an error for the #include "dayType.hpp"
dayType.cpp
#include"dayType.hpp" string dayType::weekday[7] = {"Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat" }; //set the day void dayType::setDay(string day){ cout << "Set day to: " ; cin >> dayType::day; for(int i=0; i<7; i++) { if(dayType::weekday[i]==dayType::day) { dayType::markDay = i; } } } //print the day void dayType::printDay() { cout << "Day = " << dayType::day << endl; } string dayType::getDay(){ return dayType::weekday[dayType::markDay]; } //print the next day string dayType::getNextDay(){ string next; if(markDay == 6){ next = dayType::weekday[0]; } else{ next = weekday[markDay+1]; } return next; } //print the previous day string dayType::getPrevDay(){ string prev; cout << markDay << endl; if(markDay == 0){ prev =weekday[6]; } else{ prev = weekday[markDay-1]; } return prev; } //add days string dayType::addDays(){ int addDay = 0, i = markDay, count=0; cout << "How many days do you want to add: "; cin >> addDay; while(count #ifndef DAYTYPE_HPP #define DAYTYPE_HPP #include #include using namespace std; class dayType { //everything can access these public: static string weekday[7]; void setDay(string day); //set the day void printDay(); //print the day string getDay(); string getNextDay(); string getPrevDay(); string addDays(); dayType(); //default constructor dayType(string day); // //only accessable by class children protected: //only accessable by class private: int markDay ; string day ; }; #endif main.cpp #include"dayType.hpp" int main() { dayType myDayType; myDayType.setDay("Sun"); myDayType.printDay(); myDayType.getDay(); cout << "Tommorow is " << myDayType.getNextDay() << endl; cout << "Yesterday is " << myDayType.getPrevDay() << endl; cout << "Return day is " << myDayType.addDays() << endl; } .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
