1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
____ [38]
4 years ago
13

Write a C++ program to display yearly calendar. You need to use the array defined below in your program. // the first number is

the month and second number is the last day of the month. into yearly[12][2] =
Engineering
1 answer:
ddd [48]4 years ago
3 0

Answer:

//Annual calendar

#include <iostream>

#include <string>

#include <iomanip>

void month(int numDays, int day)

{

int i;

string weekDays[] = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};

// Header print

      cout << "\n----------------------\n";

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

{

cout << left << setw(1) << weekDays[i];

cout << left << setw(1) << "|";

}

cout << left << setw(1) << "|";

      cout << "\n----------------------\n";

      int firstDay = day-1;

      //Space print

      for(int i=1; i< firstDay; i++)

          cout << left << setw(1) << "|" << setw(2) << " ";

      int cellCnt = 0;

      // Iteration of days

      for(int i=1; i<=numDays; i++)

      {

          //Output days

          cout << left << setw(1) << "|" << setw(2) << i;

          cellCnt += 1;

          // New line

          if ((i + firstDay-1) % 7 == 0)

          {

              cout << left << setw(1) << "|";

              cout << "\n----------------------\n";

              cellCnt = 0;

          }

      }

      // Empty cell print

      if (cellCnt != 0)

      {

          // For printing spaces

          for(int i=1; i<7-cellCnt+2; i++)

              cout << left << setw(1) << "|" << setw(2) << " ";

          cout << "\n----------------------\n";

      }

}

int main()

{

int i, day=1;

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}};

string months[] = {"January",

"February",

"March",

"April",

"May",

"June",

"July",

"August",

"September",

"October",

"November",

"December"};

for(i=0; i<12; i++)

{

//Monthly printing

cout << "\n Month: " << months[i] << "\n";

month(yearly[i][1], day);

if(day==7)

{

day = 1;

}

else

{

day = day + 1;

}

cout << "\n";

}

return 0;

}

//end

You might be interested in
Select the correct text in the passage.
sineoko [7]
It is habahi Yw with yuuuuuy I am a little more confused about
5 0
3 years ago
Read 2 more answers
How to make a police car ​
S_A_V [24]

search it and you will get on internet

3 0
2 years ago
What is the mechanical advantage of a pulley with 3 support ropes?
snow_tiger [21]

Answer:

The mechanical advantage is 3 to 1

Explanation:

A frictionless pulley with three support ropes carries equal tension on each of the ropes thus;

Tension in each pulley rope = T

Total tension in the 3 ropes = 3 × T = 3·T

Direction of the tension forces on each rope = Unidirectional

Total force provided by the 3 ropes = 3·T

Therefore, a force, T, applied at the end of the rope will result in a lifting force of 3·T

Hence, the mechanical advantage = 3·T to T which is presented as follows;

Mechanical \ advantage = \dfrac{3 \cdot T}{T}  = \dfrac{3}{1}

The mechanical advantage = 3 to 1.

5 0
3 years ago
For a short time a rocket travels up and to the left at a constant speed of v = 650 m/s along the parabolic path y=600−35x2m, wh
julia-pushkina [17]

Answer:

Detailed working is shown

Explanation:

The attached file shows a detailed step by step calculation..

4 0
3 years ago
An angle is observed repeatedly using the same equipment and procedures producing the data below:35 ∘ 40'00",35 ∘ 40'10",35 ∘ 40
Helen [10]

Answer: (a) +/- 7.5° (b) +/- 3.75°

Explanation:

See attachment

6 0
3 years ago
Other questions:
  • For the following gear train, if the blue gear is moving at 50 rpm, what are the speeds of the other gears?
    14·1 answer
  • Why or why not the following materials will make good candidates for the construction of
    15·1 answer
  • write an interface downloadable that has a method "geturl" that returns the url of a downloadable object
    5·1 answer
  • Air pressure is higher above an airfoil.<br> true or false
    14·1 answer
  • Two loads connected in parallel draw a total of 2.4 kW at 0.8 pf lagging from a 120-V rms, 60-Hz line. One load absorbs 1.5 kW a
    5·1 answer
  • Two sites are being considered for wind power generation. On the first site, the wind blows steadily at 7 m/s for 3000 hours per
    5·1 answer
  • Porque el invento de la bombilla es importante?
    6·1 answer
  • below is an attempt at implementing a circle class. the class should feature a constructor that takes a starting radius, a float
    13·1 answer
  • The density of a certain type of steel is 8.1 g/cm3. What is the mass of a 100 cm3 chunk of this steel
    10·1 answer
  • A plant has ten machines and currently operates two 8-hr shift per day, 5 days per week, 50 weeks per year. the ten machines pro
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!