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
The World Wide Web is full of unstructured data. Search engines like Google, Bing and Yahoo have been doing a good job of allowi
bija089 [108]

Answer: Query

Explanation:

The Search Criteria is entered and any when a related Query is logged, it speedily bring out the linked details for exploration.

5 0
3 years ago
What is the main role of LDAP?
NISA [10]

Answer:

Run directory services

Explanation:

LDAP (Lightweight Directory Access Protocol) is an open protocol used to access some information, information that is stored in a network, the information is organized hierarchical structure, we could find some data like names, directories, and telephone numbers.

With other options, we can find DHCP to assign IP addresses and to resolve IP addresses to host names, we have the DNS.

7 0
3 years ago
The key invention that enabled computers to go into every home and office is
Scrat [10]
<span><span />The Microprocessor is the key invention that enabled computers to go into every home and office. Microprocessor is a computer processor that enables the computer to run. It is also called as central processing unit. It is also a multipurpose and programmable device that accepts inputted data and process the data to provide an output. Microprocessor started from 8-bit design to 16bit, 32 bit, 64 bit and now it is produce a multi core design in the market. Faster and stronger design that can run heavier applications.</span>



8 0
3 years ago
BRAINLIEST
Brilliant_brown [7]

Answer:

1. Don't

2. Do

3. Don't

4. Don't

5. Do

Hope it helps.......

3 0
3 years ago
Read 2 more answers
How do I get rid of this little tool bar????
Serhud [2]

Answer:

settings>Accessibility>Touch>AssistiveTouch>Turn off

Explanation:

4 0
3 years ago
Other questions:
  • Diane is receiving a lot of unwanted e-mail. What steps can she take to reduce the amount of e-mail she receives?
    12·1 answer
  • Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed
    13·1 answer
  • Reading log of any book with page numbers​
    5·1 answer
  • The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
    15·1 answer
  • All of the following are helpful tips for protecting your digital privacy, except:
    10·2 answers
  • 7.5 Code practice Plz answer ASAP
    15·1 answer
  • Write a method that accepts an integer argument and returns the sum of all the integers from 1 up to (and including) the number
    14·1 answer
  • 7. Type the correct answer in the box. Spell all words correctly.
    8·1 answer
  • what is one category of software mentioned in the unit materials as being example of groupware English technical
    15·1 answer
  • What does data warehousing allow organizations to achieve?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!