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
A horizontal rigid bar ABC is pinned at end A and supported by two cables at points B and C. A vertical load P 5 10 kN acts at e
BARSIC [14]

Answer:

vertical load = 10 kN

Modulus of elasticity = 200GPa

Yield stress on the cable = 400 MPa

Safety factor = 2.0

Explanation:

Data

let L = \sqrt{(1.5)^{2} + (1.5)^{2} }

        = 3.35 m

substituting 1.5 m for h and 3 m for the tern (a + b)

\theta = tan⁻¹(\frac{1.5}{1.5})

  = 45⁰

substituting 1.5 for h and 3 m for (a+ b) yields:

\theta₂ = tan⁻¹ (\frac{1}{3})

   =25.56⁰

checking all the forces, they add up to zero. This means that the system is balanced and there is no resultant force.

6 0
3 years ago
Why is the face of the claw on a claw hammer usually a smooth curve? Why isn't it straight or some other shape?
GarryVolchara [31]

Answer:

The face of the claw on the claw hammer is usually a smooth curve so as to improve the ease with which nails are removed when removing nails because as the nail held between the V shaped split claw is being pulled out from the wood, it slides more and more towards cheek, reducing the distance of the nail from the cheek which is the fulcrum, thereby increasing the mechanical advantage because the location of the hand on the grip remains unchanged

Explanation:

7 0
3 years ago
Q1: The first option should always be to get out safely (RUN)
nekit [7.7K]

Answer:

Q1 true

Q2 true

And other I am confuse

6 0
3 years ago
18. What is being shown in the above Figure?
slavikrds [6]

D. Camshaft gear backlash is being checked​

hope this helps :)

8 0
3 years ago
Read 2 more answers
13–27. The conveyor belt is moving downward at 4 m&gt;s. If the coefficient of static friction between the conveyor and the 15-k
Feliz [49]

Answer:

See explanation for step by step procedure to get answer.

Explanation:

Given that:

The conveyor belt is moving downward at 4 m>s. If the coefficient of static friction between the conveyor and the 15-kg package B is ms = 0.8, determine the shortest time the belt can stop so that the package does not slide on the belt.

See the attachments for complete steps to get answer.

4 0
3 years ago
Other questions:
  • why are apartments called apartments if there together? and why are buildings called buildings if there already built? hmmmm
    7·1 answer
  • On the first statistics exam, the coefficient of determination between the hours studied and the grade earned was 80%. The stand
    5·1 answer
  • Transmission cleaners are used: A) Only in conjunction with fuel system cleanersB) Only in the colder monthsC) By themselvesD) I
    13·2 answers
  • Народ творець української пісні
    15·1 answer
  • Water enters a tank of diameter Dt steadily at a mass flow rate of m&amp; . An orifice at the bottom with a diameter of Do allow
    11·1 answer
  • technician A says that a technician can progress to different jobs within the industry. Technician B says that career in the aut
    5·1 answer
  • The basic concept of feedback control is that an error must exist before some corrective action can be made?
    12·1 answer
  • The tool life decreases from 0.8 min to 0.2 min due to the increase in cutting speed from 60 m/min to 120 m/min in a turning ope
    12·1 answer
  • Compute the atomic density (the number of atoms per cm3 rather than mass density g/cm3) for a perfect crystal of silicon at room
    14·1 answer
  • Concepts of Engineering and Technology Virt(1) / Unit 3: From Sketches to Products
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!