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
Inessa [10]
3 years ago
5

Write a function named days() that determines the number of days since January 1, 1900 for any data passed as a structure. Use t

he Date structurestruct Date{int month;int day;int year;};In writing the days() function, use the convention that all years have 360 days and each month consists of 30 days. The function should return the number of days for any Date structure passed to it. Write a main () function to test your function.
Computers and Technology
1 answer:
Lisa [10]3 years ago
3 0

Explanation:

#include <stdio.h>

#include <stdlib.h>

struct date

{

int month;

int day;

int year;

};

int days(struct date *d)

{

int daysTotal;

// Adding days from date::day

if (d->day > 0 && d->day < 31) // Only execute if day is valid

{

daysTotal = d->day - 1;

}// Adding days from date::month

if (d->month > 0 && d->month < 13) // Only execute if month is valid

{

daysTotal += 30 * (d->month-1);

}// Adding days from date::year

if (d->year > 1899) // Only execute if year is valid

{

daysTotal += 360 * (d->year-1900); // subtracting 1900 years

}

return daysTotal; // This may still be a negative value, but is accepted here for simplicity

}

int main()

{

struct date myDate;

printf("Enter a Month: ");

scanf("%d", &myDate.month);

printf("Enter a Day: ");

scanf("%d", &myDate.day);

printf("Enter a Year: ");

scanf("%d", &myDate.year);

printf("the date you entered = %d days", days(&myDate));

return 0;

}

You might be interested in
What is the code for loading image in matlab
MA_775_DIABLO [31]

Answer: Using imread command

Explanation:

For loading images in matlab we can use the imread command. Some example regarding how to use the code is as follows:

A = imread('ball.tif');

Here suppose the image file name is saved as ball and is in tif format. Here the image is stored in an array named A.

We can view the image using

imshow(A);

7 0
4 years ago
What is the viewport?
Shtirlitz [24]
C. The viewing area of a web browser.

The viewport is the user's visible area of a web page.
5 0
3 years ago
HELP PLX ITS PYTHON BTW!!!
ExtremeBDS [4]

Answer:

Sebastian is your last name diaz

Explanation:

Functions allow us to break our program into multiple parts

Multiple is the answer

Atlanta-Robinson

5 0
3 years ago
How to play Drinkopoly game?
professor190 [17]
Answer:
Never heard of that lol
3 0
3 years ago
An organization’s IRP prioritizes containment over eradication. An incident has been discovered where an attacker outside of the
emmasim [6.3K]

Answer:

The correct answer is (a) Remove the affected servers from the network.

Explanation:

Solution:

Now, since the organisation top priority is more of  containment over eradication, an outbreak code that is hostile as an can be suppressed effectively by removing the web server completely from the over all network facilities or infrastructure.

Also, if the affected servers are not removed, it might affect the integrity, confidentiality of sensitive materials or documents which will be exposed to the outside world by the attacker.

4 0
3 years ago
Other questions:
  • Which of the following is the rarest and most valuable mineral ore among the native elements?
    13·1 answer
  • To access WordPad, Jill will click on Start, All Programs, Accessories, and WordPad. To access Notepad, Karl will click on Start
    11·1 answer
  • In cell R9, enter a formula using the AVERAGEIF function to determine the average number of years of experience for lifeguards.
    12·1 answer
  • You are part of a team that is setting up a movie streaming service. The company is planning on initially making available 500 m
    8·1 answer
  • Which type of financial institution typically has membership requirements?
    9·2 answers
  • A system administrator is selecting an operating system for use by the company’s research and development team. The team require
    15·1 answer
  • A firm can survive and succeed in the long run if it successfully develops strategies to confront the _______________ that shape
    9·1 answer
  • What are the advantages of using digital signals over analog signals? Scientist have found advantages when they convert digital
    5·2 answers
  • Which of the following are the most important reasons people in the 1920s were so interested in seeing lifelike stories in audio
    6·1 answer
  • What Pre-Built PC should I get? I don't have a lot of money so I'm looking for cheap options.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!