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
Anna [14]
3 years ago
6

Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in

t to represent the day.
Computers and Technology
1 answer:
frozen [14]3 years ago
8 0

Answer:

void season(char * month, int day){

if(strcpy(month, "January") == 0 || strcpy(month, "February") == 0)

printf("Winter\n");

else if(strcpy(month, "March") == 0){

if(day < 20)

printf("Winter\n");

else

printf("Spring\n");

}

else if(strcpy(month, "April") == 0 || strcpy(month, "May") == 0)

printf("Spring\n");

else if(strcpy(month, "June") == 0){

if(day < 20)

printf("Spring\n");

else

printf("Summer\n");

}

else if(strcpy(month, "July") == 0 || strcpy(month, "August") == 0)

printf("Summer\n");

else if(strcpy(month, "September") == 0){

if(day < 20)

printf("Summer\n");

else

printf("Autumn\n");

}

else if(strcpy(month, "October") == 0 || strcpy(month, "November") == 0)

printf("Autumn\n");

else if(strcpy(month, "December") == 0){

if(day < 20)

printf("Autumn\n");

else

printf("Winter\n");

}

}

Explanation:

I am going to write a C program for this.

I am going to use the function strcpy, from the library string.h, to compare strings. It returns 0 when strings are equal.

I am going to say that the season change happens at day 20, in March, June, September and December

void season(char * month, int day){

if(strcpy(month, "January") == 0 || strcpy(month, "February") == 0)

printf("Winter\n");

else if(strcpy(month, "March") == 0){

if(day < 20)

printf("Winter\n");

else

printf("Spring\n");

}

else if(strcpy(month, "April") == 0 || strcpy(month, "May") == 0)

printf("Spring\n");

else if(strcpy(month, "June") == 0){

if(day < 20)

printf("Spring\n");

else

printf("Summer\n");

}

else if(strcpy(month, "July") == 0 || strcpy(month, "August") == 0)

printf("Summer\n");

else if(strcpy(month, "September") == 0){

if(day < 20)

printf("Summer\n");

else

printf("Autumn\n");

}

else if(strcpy(month, "October") == 0 || strcpy(month, "November") == 0)

printf("Autumn\n");

else if(strcpy(month, "December") == 0){

if(day < 20)

printf("Autumn\n");

else

printf("Winter\n");

}

}

You might be interested in
A cpu with an external clock speed of 2 ghz and a 64-bit data bus can (theoretically) transfer how much data per second?
GREYUIT [131]
The CPU could cycle the bits 2000000000 a second. That means theoretically it could process 16 gigabytes of data a second.
5 0
3 years ago
Consider the following code which deletes all the nodes in a linked list. void doublyLinkedList::destroy() { nodeType *temp; //p
Lera25 [3.4K]

Answer:

The answer is "delete temp;".

Explanation:

  • In the given code a class "doublyLinkedList" is defined that contains a method that is destroy(). This code uses a scope resolution operator to define the method outside the class.
  • To access this method write return type of function then class name:: (use scope resolution operator) and function name.
  • In this function, nodeType temp is a pointer variable that is used to delete the node.
  • In method definition, a loop is declared that check value that is first not equal to nullptr. which means the first node is not equal to null. In this loop, a temp variable holds the first variable value and the first variable value is holding another variable value and then use the "delete temp" statement to delete a node in the list.
  • Outside a loop, the last variable holds nullptr variable value and the count variable assigns a value that is 0.
5 0
3 years ago
Rose has a list of two columns of information separated by tabs. She wants to input this information into a table. What is the f
andreev551 [17]
I gotchu my bro!!
it would be D. " clicking Convert Text to Table"
7 0
3 years ago
Read 2 more answers
You discover that the lecturers will be using the laptops for online and video lecturing, and you see the need to upgrade the RA
Step2247 [10]

The RAM of G.Skill Trident Z Neo 3600 will be highly recommended for online and video lecturing.

<h3>What is RAM?</h3>

This is referred to random access memory and store information which can be retrieved quickly.

The RAM of G.Skill Trident Z Neo 3600 is 32GB which ensures the speed of the processor is fast.

Read more about RAM here brainly.com/question/13748829

#SPJ9

7 0
1 year ago
Read 2 more answers
The ____ is a tool in versions of microsoft office starting with office 2007 that consists of tabs, which contain groups of rela
tankabanditka [31]

The answer is A. The Ribbon is a UI component which was presented by Microsoft in Microsoft Office 2007. It is situated underneath the Quick Access Toolbar and the Title Bar. It includes seven tabs; Home, Insert, Page design, References, Mailing, Review and View. Every tab has particular gatherings of related summons.

6 0
3 years ago
Other questions:
  • When purchasing a(n) ________ computer, having cellular as well as wifi can be important?
    9·1 answer
  • While a hard drive is running, even a slight bump against the computer may cause the
    9·2 answers
  • How can you autohide the taskbar in Windows 10?
    8·2 answers
  • You would like to conduct a survey and ask your web page visitors to indicate the computer operating systems that they use. Each
    10·1 answer
  • Eye wash stations should contain enough water to provide ______ minutes of continuous use
    5·2 answers
  • Which ofthe following sentence beginnings would be best to use in apersuasive request?
    8·1 answer
  • What outline feature can the Navigation pane browse the document by?
    14·2 answers
  • is used to reduce the chance of an individual violating information security and breaching the confidentiality, integrity, or av
    6·1 answer
  • What are the benefits of computer literacy?
    10·1 answer
  • Describe the plot of the Matrix
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!