Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Programming Write a function that takes a date and prints out what day it is. The formula for finding the day of the week

C Programming

Write a function that takes a date and prints out what day it is. The formula for finding the day of the week by entering the given year, month, and day is:

(year + year/4 - year/100 + year/400 + (13 * month + 8) / 5 + day) % 7

This result (0 ~ 6) and Sunday, Monday, ... , Saturday, and write the program. Enum can be used as one integer variable. For example, it can be used for switch, comparison, and for and while condition. The prototype of the function is as follows. enum Date getDate (int y, int m, int d); // return the value corresponding to the day of the week char * getDay (enum Date currDate); // return the string of the day corresponding to currDate Implement the following structure to store the data for this program. (where date is an enum variable representing the value from Sunday through Saturday)

struct Calendar{

int year, month, day;

enum Date date; // getDate function

char* dateString; // getDay function

};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

LO3 Discuss the steps of a typical selection process.

Answered: 1 week ago