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 int to represent the day.

1 answer
Question:

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 int to represent the day.

Answers

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");elseprintf("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");elseprintf("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");elseprintf("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");elseprintf("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 Decembervoid 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");elseprintf("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");elseprintf("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");elseprintf("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");elseprintf("Winter\n");}}

Similar Solved Questions

1 answer

Third grade Which type of money controls spending but may be inconvenient to have all the time? Check credit card debit card cash the answer

third grade Which type of money controls spending but may be inconvenient to have all the time? Check credit card debit card cash the answer...
1 answer

What are the sex chromosomes of a female mammal?either of a pair of chromosomes that determine whether an individual is male or female

What are the sex chromosomes of a female mammal?either of a pair of chromosomes that determine whether an individual is male or female...
1 answer

Select the correct answer. Xavier is giving Flavie instructions on how to surf. Which question best completes the conversation? Flavie: ___________________________________ Xavier: Pour apprendre le surf, il est nécessaire de savoir nager. A. Qui est nécessaire pour apprendre le surf? B. Pourquoi est-ce nécessaire d’apprendre le surf? C. Comment est-ce nécessaire d’apprendre le surf? D. Qu’est-ce que le surf nécessite?

Select the correct answer. Xavier is giving Flavie instructions on how to surf. Which question best completes the conversation? Flavie: ___________________________________ Xavier: Pour apprendre le surf, il est nécessaire de savoir nager. A. Qui est nécessaire pour apprendre le surf? B. Pourquoi e...
2 answers

How do you know what the solution is to a system of equations by graphing?

How do you know what the solution is to a system of equations by graphing?...
2 answers

Although Southern Europe is cold and wet, Northern Europe is even colder with snow throughout the year. Please select the best answer from the choices provided T F

Although Southern Europe is cold and wet, Northern Europe is even colder with snow throughout the year. Please select the best answer from the choices provided T F...
2 answers

BRAINLIEST!!!!! Which image displays a chemical property about a substance? Choose all that apply.

BRAINLIEST!!!!! Which image displays a chemical property about a substance? Choose all that apply....
2 answers

Everyone help me please

Everyone help me please...
2 answers

Write a summary about harry potter and the half blood prince.

Write a summary about harry potter and the half blood prince....
1 answer

What Technology is used to study the biosphere

What Technology is used to study the biosphere...
1 answer

What is one common way of concluding a set of instructions?

what is one common way of concluding a set of instructions?...
1 answer

The length of a rectangle is 3 m longer than its width. The area of the rectangle is 154m^2 What is the width of the rectangle? ___m

The length of a rectangle is 3 m longer than its width. The area of the rectangle is 154m^2 What is the width of the rectangle? ___m...
2 answers

Which property of gold BEST makes panning possible

Which property of gold BEST makes panning possible...
1 answer

Which words in the sentence are conjunctions? When Shelley sings, she both inspires and amazes her audience. Choose all answers that are correct. A. and B. both C. sings D. her

Which words in the sentence are conjunctions? When Shelley sings, she both inspires and amazes her audience. Choose all answers that are correct. A. and B. both C. sings D. her...
1 answer

A triangle has sides with lengths of 48 inches, 54 inches, and 78 inches. Is it a right triangle?

A triangle has sides with lengths of 48 inches, 54 inches, and 78 inches. Is it a right triangle?...
1 answer

How did the issue of states' rights contribute to the outbreak of the Civil War?

How did the issue of states' rights contribute to the outbreak of the Civil War?...
1 answer

. Evaluate 8^0 helppp please

. Evaluate 8^0 helppp please...
1 answer

How long does it take to recover from a hamstring injury

how long does it take to recover from a hamstring injury...

-- 0.051000--