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]
4 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]4 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
Suppose company A wants to develop a program that duplicates the functionality of a programm by company B. Describe how company
kompoz [17]
The design of the software is covered by copy right unless it is open sourced or is a very common interface. They would need to come up with their own design and way of solving the problem to have a solution that was not copyrighted.
5 0
4 years ago
When using e-mail for business purposes, employees should _____.
harina [27]

Answer:use spell check

proofread messages

use appropriate punctuation

be brief

use correct grammar

Explanation:

3 0
3 years ago
The term “computer literacy” dates back to what decade? <br> 1960s<br> 1970s<br> 1980s<br> 1990s
NNADVOKAT [17]
1970-80s which is when some of the first computers were created like apple computers which looked like a giant cube and a rectangle on the side which is very different than what we have today.

Hope this helps!
3 0
4 years ago
What questions do they ask for the 08.03 Discussion- Based Assesment in Drivers Ed?? Thanks.
mel-nik [20]

When should my headlights be turned on?

Why shouldn't one take medication before driving?

Why must you use a turn signal?

I'm not sure about that last one because I forgot but I think its right.

6 0
4 years ago
Joe wants to use pictures from the internet in a word processing program which is the most important aspect that Joel should con
MrRa [10]
I would say B-copyright.
6 0
4 years ago
Read 2 more answers
Other questions:
  • Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines. Each line contains an a
    9·1 answer
  • Which of the following is a preferable method to secure wireless access in a SOHO?
    12·1 answer
  • Write a simple compilable program that outputs to an Excel-compatible XLS file these two rows: (1) a header row with headings fo
    10·1 answer
  • one_diff(a?): Description: Determine if there is exactly one character different between exactly two strings. Parameters: Determ
    5·1 answer
  • Complex calculations show that if the universe is geometrically flat, we should observe the greatest temperature differences bet
    9·1 answer
  • Given main() and a base Book class, define a derived class called Encyclopedia. Within the derived Encyclopedia class, define a
    10·1 answer
  • Give your definition of a stored procedure. Based on the Academic Database, identify and describe a scenario where it would be n
    12·1 answer
  • One disadvantage of online information sharing is that:
    14·2 answers
  • When does the following while-loop stop running?
    10·1 answer
  • Chris needs to modify the default bullets that are used in a nonnumbered list in Word.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!