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
For security reasons a network administrator needs to ensure that local computers cannot ping each other. which settings can acc
liq [111]
<span>The administrator of the network can access the admin settings on the network's primary DNS servers. From there, there are hundreds of various settings and changes to make. There is one, however, that is able to disable pings. This will prevent computers from responding to ping requests. This can help to ensure internal security and reduce internal network traffic.</span>
6 0
3 years ago
Bloodborne pathogens travel by way of blood cells and can only be spread by person-to-person contact with infected blood
Eva8 [605]
That is incorrect. It is only contagious if blood is injected into person who is not infected.
5 0
3 years ago
Read 2 more answers
True or false, USBs are slower than RAM.
Zina [86]

Answer:

False

Explanation:

6 0
3 years ago
When you hear the word "automation" what comes to mind?
zloy xaker [14]

Answer:

The act of operation without direct control by a person.

Explanation:

The encyclopedia describes automation as “the procedure of producing an equipment, a method, or an arrangement function automatically.” We describe automation as "the formulation and utilization of technology to observe and regulate the reproduction and distribution of products and assistance.” to the society.

4 0
3 years ago
Need help with 4.7 lesson practice
OverLord2011 [107]

Answer:

1.a

2.sorry cant read it that wekk

3.c

Explanation:

7 0
3 years ago
Other questions:
  • Teachers in most school districts are paid on a schedule that provides a salary based on their number of years of teaching exper
    10·1 answer
  • Sometimes, fourth-generation languages (4GLs) are called procedural languages
    9·1 answer
  • RrayList Mystery Consider the following method:
    9·1 answer
  • A Layer 2 switch configuration places all its physical ports into VLAN 2. The IP addressing plan shows that address 172.16.2.250
    7·1 answer
  • Sniffer turns the NIC of a system to the promiscuous mode so that it listens to all the data transmitted on its segment. It can
    5·1 answer
  • Viruses and worms can affect a system by:
    11·2 answers
  • Explain the relevancy of computers in today's global society​
    11·1 answer
  • Create a CourseException class that extends Exception and whose constructor receives a String that holds a college course’s depa
    8·1 answer
  • In 1956, the unit byte was coined by American statistician and computer scientist John Tukey
    11·1 answer
  • The local Driver's License Office has asked you to write
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!