`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
#include <iostream>
#include <cstdlib>
using namespace std;
//Function Prototype
string getMonthName(int monthNumber);
// Main Function
int main()
{
//declare array
// the first number is the month and second number
//is the last day of the month.
int yearly[12][2] = {{1,31},{2,28},{3,31},{4,30},{5,31},
{6,30},{7,31},{8,31},{9,30},{10,31},
{11,30},{12,31}
};
int month;
//display yearly calendar
for(month = 0; month < 12; month++)
{
int day;
// get days in the month
int daysInMonth = yearly[month][1];
cout << getMonthName(month) + " " ;
// display output
for(day = 1; day <= daysInMonth; day++)
{
cout << day << " " ;
}
// line feed for month
cout << endl;
}
system ("pause");
return 0;
}
// Returns the month name in 3 chars
string getMonthName(int monthNumber)
{
string month[] = {"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"
};
return (month[monthNumber]);
}
Kindly revert for any queries
Thanks.
Write a C++ program to display yearly calendar. You need to use the array defined below...
Write a C++ program that demonstrates use of programmer-defined data structures (structs), an array of structs, passing an array of structs to a function, and returning a struct as the value of a function. A function in the program should read several rows of data from a text file. (The data file should accompany this assignment.) Each row of the file contains a month name, a high temperature, and a low temperature. The main program should call another function which...
Write a C# program that prints a calendar for a given year. Call this program calendar. This program needs to use Switch Case in order to call the methods and format to print each month. The program prompts the user for two inputs: 1) The year for which you are generating the calendar. 2) The day of the week that January first is on, you will use the following notation to set the day of the week: ...
Write a C# program that prints a calendar for a given year. Call this program calendar. The program prompts the user for two inputs: 1) The year for which you are generating the calendar. 2) The day of the week that January first is on, you will use the following notation to set the day of the week: 0 Sunday 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday Your program should...
Write a Program in C language for: 1. Create a C program to read 7 integers and store them in an array. Next, the program is to check if the array is symmetric, that is if the first element is equal to the last one, the value of the second one is equal to the value of the last but one, and so on. Since the middle element is not compared with another element, this would not affect the symmetry...
Write a program that, given a month and year, prints a calendar, such as June 2016 Su Mo Tu We Th Fr Sa 5 6 7 8 910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 To find out the weekday of the first day of the month, call this function: Computes the weekday of a given date. @param year the year @param month the month (1=January 12=...
Write a C++ program to display workers schedule for a company. To accomplish this (1) Write a struct Time with attributes (at least) : hours, minutes and seconds. Add other functions or attributes you need to get the job done (2) Write a class Schedule with attributes : Day of week, start_time, end_time and activity. Schedule should have at least (a) Display to display the schedule (b) Length to return the duration of the schedule (ie end_time - start_time), (c)...
Write a C program Design a program that uses an array to store 10 randomly generated integer numbers in the range from 1 to 50. The program should first generate random numbers and save these numbers into the array. It will then provide the following menu options to the user: Display 10 random numbers stored in the array Compute and display the largest number in the array Compute and display the average value of all numbers Exit The options 2...
Please I need code in C++ Write a program that creates an int array of size 10, then uses a for-loop to populate the array with numbers from your favorite number pattern.
Write a C++ program that does the following : 1. Accepts array size from the keyboard. The size must be positive integer that is >= 5 and <= 15 inclusive . 2. Use the size from step 1 in order to create an integer array. Populate the created array with random integer values between 10 and 200. 3. Display the generated array. 4. Write a recursive function that displays the array in reverse order . 5. Write a recursive function...
Write a C++ program that contains 2 functions. LastLargestIndex, that takes as paraneters an int array and // its size and returns the index of the first occurrence of the largest element II in the array. Also, write a function to display the array #include ·peh.h" #include <iostream> using namespace std const int ARRAY_SIZE = 15; int main int list[ARRAY SIZE56, 34, 67, 54, 23, 87, 66, 92. 15, 32, 5, 54, 88, 92, 30 cout < List elements: "...