Question: I have a script for my class I'm working on, It displays the the previouse day, the current day and the next day, but I'm

I have a script for my class I'm working on, It displays the the previouse day, the current day and the next day, but I'm trying to add a number that will count the days and display a day.

I keep getting an error on the xstring line here:

size_type size() const _NOEXCEPT

{ // return length of sequence

return (this->_Mysize());

}

Here is the code I'm working on:

#include "stdafx.h"

#include

#include

#include

using namespace std;

class daytype

{

string day[7];

string d;

int counter;

int tar;

public:

daytype()

{

day[0] = ("Monday");

day[1] = ("Tuesday");

day[2] = ("Wednesday");

day[3] = ("Thursday");

day[4] = ("Friday");

day[5] = ("Saturday");

day[6] = ("Sunday");

}

void printDay()

{

for (int i = 0; i < 7; i++)

cout << (i + 1) << ":" << day[i] << endl;

}

void getDay()

{

string z;

cout << "Enter The Day: " << endl;

getline(cin, z);

d = z;

}

void compare()

{

for (int i = 0; i < 7; i++)

if (d == day[i])

counter = i;

}

void PreviousNext()

{

if (counter > 0)

cout << "The Previous Day Was: " << day[counter - 1] << endl;

else

cout << "The Previous Day Was: " << day[6] << endl;

cout << "Today is: " << day[counter] << endl;

if (counter < 6)

cout << "The Next Day Is: " << day[counter + 1] << endl;

else

cout << "The Next Day Is: " << day[0] << endl;

if (counter > 6)

cout << "The Added Day Is: " << day[counter + tar] << endl;

else

cout << "The Added Day Is: " << day[counter + tar] << endl;

}

int getNumber()

{

int tar;

cout << "Enter A Number To Add: " << endl;

cin >> tar;

return tar;

}

void F_day(int tarD)

{

int l = tarD % 7;

if ((l + counter) >= 6)

{

l = (counter + l) % 7;

cout << "The Day After Is: " << tarD << "The Day Is: " << day[l] << endl;

}

else if (l == 0)

cout << "The Day After Is: " << tarD << "The Day Is: " << day[counter] << endl;

}

};

void main()

{

int tar;

daytype day;

day.printDay();

day.getDay();

day.compare();

tar = day.getNumber();

day.PreviousNext();

day.F_day(tar);

system("pause");

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!