How to use dates in C?

Asked

Viewed 141 times

1

I wanted to know how to implement the library time.h

The application must identify the customer, the start and end date of the rental, and the price paid for the rental and the date paid.

We have the following structures:

typedef struct Aluguer

    struct tm data_inicio;                  
    struct tm data_fim;                     
    int preco;                         
    struct tm data_pagamento;               
    int pagaEfetuado; // -- 0 -> não pago || 1 -> pago
}ALUGUER;



typedef struct Elem{

  ALUGUER node;

  struct Elem *seguinte;

}ELEMENTO;

The exercise asks us to list all available vehicles to rent for a certain period (date range).

How should I proceed?

  • Here is a reference to how to use the time library. h http://www.cplusplus.com/reference/ctime/localtime/

  • This? https://answall.com/a/126795/101

  • "how to implement the time. h library" - how so ? The library already exists and has several things defined, such as the struct tm which you are using in your code. What will be the dates set in your application ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.