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]
3 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]3 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
How engineer can find problems and solutions <br><br><br> Give example
Mademuasel [1]

Answer:

They find problems and solutions by working together

Explanation:

4 0
3 years ago
The settlement of foundations is typically the result of three separate occurrences that take place in the soil which provides s
evablogger [386]

Answer:

The differences are listed below

Explanation:

The differences between consolidation and compaction are as follows:

In compaction the mechanical pressure is used to compress the soil. In consolidation, there is an application of stead pressure.

In compaction, there is a dynamic load by rapid mechanical methods like tamping, rolling, etc. In consolidation, there is static and sustained pressure applied for a long time.

In compaction, the soil volume is reduced by removing air from the void. In consolidation, the soil volume is reduced by squeezing out water from the pores.

Compaction is used for sandy soil, consolidation on the other hand, is used for clay soil.

7 0
3 years ago
Read 2 more answers
For a turbulent flow of a fluid in 0.6 m diameter pipe, the velocity 0.15 m from the wall is 2.7 m/s. Estimate the wall shear st
MAVERICK [17]

Answer:

If the turbulent velocity profile in a pipe of diameter 0.6 m may be approximated by u/U=(y/R)^(1/7), where u is in m/s and y is in m and 0.15 m from the pipe.

Explanation:

hope it helps

3 0
2 years ago
Thick fluids such as asphalt and waxes and the pipes in which they flow are often heated in order to reduce the viscosity of the
Gala2k [10]

Answer:

what id the answer

Explanation:

7 0
3 years ago
Select the correct answer.
Brilliant_brown [7]
The answer is either b or e search it up and you will know the answer by definition
4 0
3 years ago
Read 2 more answers
Other questions:
  • A cable in a motor hoist must lift a 700-lb engine. The steel cable is 0.375in. in diameter. What is the stress in the cable?
    12·1 answer
  • Find the mathematical equation for SF distribution and BM diagram for the beam shown in figure 1.​
    10·1 answer
  • What is the difference Plastic vs elastic deformation.
    13·1 answer
  • List the main activities of exploration??
    5·1 answer
  • Write a C program that will update a bank balance. A user cannot withdraw an amount ofmoney that is more than the current balanc
    13·1 answer
  • Air,in a piston cylinder assembly, is initially at 300 K and 200 kPa.It is then heated at constant pressure to 600 K. Determine
    12·2 answers
  • A 3-m wide rectangular channel has a flow velocity of 1.8 m/s when the depth of flow is 1.2 m. what will be the flow velocity wh
    14·1 answer
  • When an electron in a valence band is raised to a conduction band by sufficient light energy, semiconductors start conducting __
    9·1 answer
  • Drum brakes are usually designed so that the condition of the lining can be checked even if the drum has not been
    9·1 answer
  • For a small company it's usually best to keep the corporate and brand image as___ as possible​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!