please help me to program this question in C or C Use Zeller

please help me to program this question in C or C++

Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for any date. Your program should request the numerical date and print the number of the day-of-the-week, as follows:

Enter the month (use a number from 1 to 12): 1

Enter the day of the month: 29

Enter the 4-digit year: 2064

1/29/2064 will be day 2 of the week. (Sunday is day 0 of the week).

Solution

?

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

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

#include <iostream>

#include <iomanip>

#include <string>

using namespace std;

string DayoftheWeek(int , int , int );

int main()

{

    int mon, day, year;

    char YorN;

    string WeekDay;

    {

    cout << \"Enter the number of the month:\";

    cin >> mon; //month of year

    cout << \"Enter day of the month:\";

    cin >> day; //day of month

    cout << \"Enter the year:\";

    cin >> year; //year number

    cout << \"The day of the week for the date you have entered is: \";

    WeekDay = DayoftheWeek(mon,day,year); //function call

    cout << WeekDay;

    cout << \".\ \";

    cout << \"\ \ \ Enter Y to try another, N to stop.\ \\t\\t\";

    cin >> YorN;

    }

    while(YorN==\'Y\'||YorN==\'y\');

    return 0;

}

string DayoftheWeek(int a,int b, int year)

//To find the day of week.

{

    string WeekDay;

    int c,d,w,x,y,z,r;

    c = year % 100;

    d = year / 100;

    if(a <= 2)

    {

        a += 10;

    }

    else

    {

        a -= 2;

    }

    {

    w = (13 * a - 1) / a;

    x = c / 4;

    y = d / 4;

    z = w + x + y + b + c - 2 * d;

    r = z % 7;

    }

    switch(r)

    {

    case 0: WeekDay = \"Sunday\";

        break;

    case 1: WeekDay = \"Monday\";

        break;

    case 2: WeekDay = \"Tuesday\";

        break;

    case 3: WeekDay = \"Wednesday\";

        break;

    case 4: WeekDay = \"Thursday\";

        break;

    case 5: WeekDay = \"Friday\";

        break;

    case 6: WeekDay = \"Saturday\";

        break;

    }

    return WeekDay;

}

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

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

#include <iostream>

#include <iomanip>

#include <string>

using namespace std;

string DayoftheWeek(int , int , int );

int main()

{

    int mon, day, year;

    char YorN;

    string WeekDay;

    {

    cout << \"Enter the number of the month:\";

    cin >> mon; //month of year

    cout << \"Enter day of the month:\";

    cin >> day; //day of month

    cout << \"Enter the year:\";

    cin >> year; //year number

    cout << \"The day of the week for the date you have entered is: \";

    WeekDay = DayoftheWeek(mon,day,year); //function call

    cout << WeekDay;

    cout << \".\ \";

    cout << \"\ \ \ Enter Y to try another, N to stop.\ \\t\\t\";

    cin >> YorN;

    }

    while(YorN==\'Y\'||YorN==\'y\');

    return 0;

}

string DayoftheWeek(int a,int b, int year)

//To find the day of week.

{

    string WeekDay;

    int c,d,w,x,y,z,r;

    c = year % 100;

    d = year / 100;

    if(a <= 2)

    {

        a += 10;

    }

    else

    {

        a -= 2;

    }

    {

    w = (13 * a - 1) / a;

    x = c / 4;

    y = d / 4;

    z = w + x + y + b + c - 2 * d;

    r = z % 7;

    }

    switch(r)

    {

    case 0: WeekDay = \"Sunday\";

        break;

    case 1: WeekDay = \"Monday\";

        break;

    case 2: WeekDay = \"Tuesday\";

        break;

    case 3: WeekDay = \"Wednesday\";

        break;

    case 4: WeekDay = \"Thursday\";

        break;

    case 5: WeekDay = \"Friday\";

        break;

    case 6: WeekDay = \"Saturday\";

        break;

    }

    return WeekDay;

}

please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for
please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for
please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for
please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for
please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for
please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for
please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for
please help me to program this question in C or C++ Use Zeller’s rule (http://mathforum.org/dr.math/faq/faq.calendar.html) to determine the day-of-the-week for

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site