Computer scienceProgramming languagesC++Types and data structures

Structures

Theory

Date

Report a typo

Write a C++ program that defines a structure called "Date" with the following members: day (int), month (int), and year (int). Create an object of the structure and initialize its members. Print the date in the format "DD/MM/YYYY".

Initialize the structure so that it takes the day of the week as an integer as input (1-Mon, 2-Tue, 3-Wed, 4-Thurs, 5-Fri, 6-Sat, 7-Sun), and outputs the date.
For verification, take the week from 05/06/2023 to 11/06/2023

Here is an example for understanding:

If you enter: 3
Then at the output we get: 07/06/2023

Sample Input 1:

1

Sample Output 1:

05/06/2023
Write a program in C++





Create a free account to access the full topic