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
(I really need help ASAP please!! this is for science her is the problem)
grandymaker [24]

Answer:

Explanation:

c

5 0
3 years ago
Read 2 more answers
A bar having a length of 5 in. and cross-sectional area of 0.7 i n . 2 is subjected to an axial force of 8000 lb. If the bar str
barxatty [35]

Answer:

E=1.969 × 10¹¹ Pa

Explanation:

The formula to apply is;

E=F*L/A*ΔL

where

E=Young modulus of elasticity

F=Force in newtons

L=Original length in meters,m

A=area in square meters m²

ΔL= Change in length in meters,m

Given

F= 8000 lb = 8000*4.448 =35584 N

L= 5 in = 0.127 m

A= 0.7 in² =0.0004516 m²

ΔL = 0.002 in = 5.08e-5 m

Applying the formula

E=(35584 * 0.127)/(0.0004516*5.08e-5 )

E=1.969 × 10¹¹ Pa

8 0
3 years ago
A car C is traveling up a spiral ramp at a constant and traveling as fast as it can without losing traction. The grade of the ra
arsen [322]

Answer:

26.1 ft/s²

Explanation:

See attached pictures for detailed explanation.

4 0
3 years ago
A column in a building is subjected to the following load effects:
vagabundo [1.1K]

Answer:

attached below

Explanation:

6 0
3 years ago
You should always engage the parking brake whenever using any type of lift.
Shtirlitz [24]

Answer:

I would yes every time so it would not role off the lift

Explanation:

8 0
3 years ago
Other questions:
  • 2. Describe the three phases of the life cycle curve Draw the curve and label it in detail (the
    13·1 answer
  • I dont undertand this coding problem (Java):
    8·1 answer
  • Technician A says a "dry park check" is a good way to check ball joints and control arm bushings for looseness. Technician B say
    15·2 answers
  • The statement that is NOT true about the difference between laminar and turbulent boundary layers is:1.the Reynolds number for a
    8·1 answer
  • The radiator of a steam heating system has a volume of 20 L and is filled with superheated water vapor at 200 kPa and 200°C. At
    7·1 answer
  • Carl why is there a dead man in the living room?
    8·1 answer
  • Select the correct answer.
    12·1 answer
  • 8) Microsoft Windows is
    13·1 answer
  • What is the likely difference between urban planning for a very old city and urban planning for a new community built very recen
    10·1 answer
  • When driving we use what type of vision
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!