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
What is the difference between a refrigeration cycle and a heat pump cycle?
sukhopar [10]

Answer:

In refrigeration cycle heat transfer from inside refrigeration

In heat pump cycle heat transfer from environment

Explanation:

heat cycle is mechanical process use for cool the temperature but

In refrigeration heat transfer from inside of refrigeration that decrease temperature of refrigerator and in heat pump it decrease temperature negligible as compare to refrigerator

5 0
3 years ago
Question 2/5
adelina 88 [10]
All of the above. Answer.
7 0
3 years ago
Tech A says that 18 AWG wire is larger than 12 AWG wire. Tech B says that the larger the diameter of the conductor, the more ele
shutvik [7]

Answer:

Both of them are wrong

Explanation:

The two technicians have given the wrong information about the wires.

This is because firstly, a higher rating of AWG means it is smaller in diameter. Thus, the diameter of a 18 AWG wire is smaller than that of a 12 AWG wire and that makes the assertion of the technician wrong.

Also, the higher the resistance, the smaller the cross sectional area meaning the smaller the diameter. A wire with bigger cross sectional area will have a smaller resistance

So this practically makes the second technician wrong too

8 0
3 years ago
Which of the following Identifies the challenges faced by scientists experimenting with using artificial photosynthesis as
bezimeni [28]

Answer:

The cost and size of materials needed to produce energy

Explanation:

Artificial photosynthesis is a chemical process that uses solar cells instead of chlorophyll to absorb sunlight and convert it into electricity. This process uses artificial leaves that require man-made catalyst to spilt water present in the air into hydrogen and oxygen. It is clear that the reaction requires heat from the sun for energy production thus the technology is expensive to be applied in most areas of the world. Additionally, results obtained from previous undertaken projects of this type has been ineffective and unsustainable because it involves a lot of trial and error.

8 0
3 years ago
Hareem and Shahad are on a road trip to Florida. They pull over to get gas, and as you may know it is sold by the gallon in the
Alona [7]

Answer:

53.3

Explanation:

4×14=56

56÷1.05=53.3

4 0
3 years ago
Other questions:
  • To cool a summer home without using a vapor compression refrigeration cycle, air is routed through a plastic pipe (k=0.15 W/m*K,
    15·1 answer
  • While having a discussion, Technician A says that you should never install undersized tires on a vehicle. The vehicle will be lo
    11·1 answer
  • A vacuum gage connected to a tank reads 30 kPa at a location where the barometric reading is 755 mmHg. Determine the absolute pr
    14·1 answer
  • Sam promises to pay Sandy $2,000 in four years and another $3,000 four years later for a loan of $2,000 from Sandy today. What i
    8·1 answer
  • If the driver gear has 5 teeth and the driven gear has 10 teeth,what is the gear ratio?​
    13·2 answers
  • Is there anyone who can help me with welding?
    7·1 answer
  • Technician A says that the enable criteria are the criteria that must be met before the PCM completes a monitor test. Technician
    8·1 answer
  • Find the remaining trigonometric functions of 0 if
    10·1 answer
  • A teenage brain is already fully developed to enable us to manage risks effectively.
    13·2 answers
  • What is the following passage saying about the relationship between sustainability and responsibility?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!