Algorithm in C to verify that a typed period (start and end date) does not overlap, even partially, with a previously registered period

Asked

Viewed 109 times

1

Galera I am creating a system algorithm and control of hotels in C for a college job , in the reservation module need to make reservations of the rooms between start date end date and when to make another reservation can not reach the previous period (start date-end date already registered), someone can help me?

  • 1

    Perhaps, considering that beginning and end are in ascending order, it might be a valid period: if ((fim < inicio_cadastrado) || (inicio > fim_cadastrado)) .

  • I tried this way already but still not perfect for certain dates

  • Explain in which cases "not quite right".

No answers

Browser other questions tagged

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