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 car increases its speed at a constant rate of 1.5 m/s2 as it rounds a curve of radius 200 m. The magnitude of the total accele
vladimir2022 [97]

Answer:

The car's instant speed is 20m/s

Explanation:

a = at + an

The above equation is a vector equation

a is the resultant acceleration

at   is the tangent acceleration

an  is the normal acceleration

See the attached diagram for solution

<h2 />

7 0
3 years ago
What is the standard half-cell potential for the oxidation of methane under acidic conditions? The reaction for methane is as fo
Yuri [45]

Answer:

The element that is oxidized is carbon.

Its oxidation state increased. It increased from -4 to +4

Explanation:

Oxidation is a process that involves increase in oxidation number.

The oxidation number of carbon in CH4 is -4

C + (1×4) = 0

C + 4 = 0

C = 0 - 4 = -4

The oxidation number of carbon in CO2 is +4

C + (2×-2) = 0

C - 4 = 0

C = 0+4 = 4

Increase in the oxidation number of carbon from -4 to +4 means carbon is oxidized

4 0
3 years ago
If datums are used as suggested below (A datum on shaft, B datum on face below the head, C datum on the hex flat) and order of p
allsm [11]

Answer:

a. Use datum on shaft

b. Use datum on hex flat

c. Use datum on face below the head

d. Use datum on shaft

When these datum are used, they will prevent translation and rotation along axis which they act.

6 0
3 years ago
2. A thin vertical panel L = 3 m high and w = 1.5 m wide is thermally insulated on one side and exposed to a solar radiation flu
n200080 [17]

Answer: 383.22K

Explanation:

L = 3m, w = 1.5m

Area A = 3 x 1.5 = 4.5m2

Q' = 750W/m2 (heat from sun) ,

& = 0.87

Q = &Q' = 0. 87x750 = 652.5W/m2

E = QA = 652.5 x 4.5 = 2936.25W

T(sur) = 300K, T(panel) = ?

Using E = §€A(T^4(panel) - T^4(sur))

§ = Stefan constant = 5.7x10^-8

€ = emmisivity = 0.85

2936.25 = 5.7x10^-8 x 0.85 x 4.5 x (T^4(panel) - 300^4)

T(panel) = 383.22K

See image for further details.

5 0
3 years ago
Q1. In electronic circuits it is not unusual to encounter currents in the microampere range. Assume a 35 μA current, due to the
Anit [1.1K]

Answer:

2.9*10^14 electrons

Explanation:

An Ampere is the flow of one Coulomb per second, so 35 μA = is 35*10^-6 C per second.

An electron has a charge of 1.6*10^-19 C.

35*10^-6 / 1.6*10^-19 = 2.9*10^14 electrons

So, with a current o 35 μA you have an aevrage of 2.9*10^14 electrons flowing past a fixed reference cross section perpendicular to the direction of flow.

7 0
3 years ago
Other questions:
  • The uniform beam is supported by two rods AB and CD that have crosssectional areas of 10 mm2 and 15 mm2 , respectively. Determin
    5·1 answer
  • The shear flow at the point depends on the value of Q for the portion of the upper flange to the right of the point. Calculate t
    14·1 answer
  • Compression is generally lost in 3 places
    15·1 answer
  • 0il with a relative density of 0,8 flows in a pipe of diameter 60 mm. A venturi meter having a throat diameter of 35 mm is insta
    11·1 answer
  • . A cylindrical metal specimen having an original diameter of 12.8 mm (0.505 in.) and gauge length of 50.80 mm (2.000 in.) is pu
    11·1 answer
  • Local technology is foundation for modern technology? justufy this statement with example.​
    12·1 answer
  • Two long conducting cylindrical shells are coaxial and have radii of 20 mm and 80 mm. The electric potential of the inner conduc
    10·1 answer
  • Determine the voltage which must be applied to a 1 k 2 resistor in order that a current of
    10·1 answer
  • A 10 kg mass is lifted to a height of 2 m What is the potiental energy at this position
    13·1 answer
  • Please help me with this question
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!