Ejemplo n.º 1
0
int main(int argc, const char * argv[]) {
    printf("test\n");
    int i;

    long x ;

    x = CountSeconds(1456,1700);
    printf("%ld\n",x);
//    struct LNode Biu; d
//    Biu.data = 12;
//    printf("%d\n",Biu.data);

//    DouLNode Head = (DouLNode) malloc (sizeof(DouLNode *));
//    DouLNode test1 =(DouLNode) malloc (sizeof(DouLNode *));
//    DouLNode test2 = (DouLNode) malloc (sizeof(DouLNode *));

    BinaryTree Root = InitBiTree();
    BinaryTree test1 = InitBiTree();
    BinaryTree test2 = InitBiTree();
    BinaryTree pointer = Root;

    Root->data = 0;
//    Root->leftChild
//    Head->next = Head;
//    test1->data = 1;
//    test2->data = 2;



    for (i = 1; i <= 3; i++) {
        printf("%d\n",pointer->data);
//        pointer = pointer->next;
    }


//    struct LNode *bb;
//    printf("%lu",sizeof(*Head));


//    free(Head);
    free(test1);
    free(test2);

    puts("test");
    puts("test");

    bulbSwitch(100);

    return 0;
}
Ejemplo n.º 2
0
void CClock::Update (float DeltaTime)
{
    // If the clock is not paused then update it!
    if (!m_Pause)
    {
        // Update the date (total time in seconds) according
        // to the type of the clock.
        switch (m_ClockType)
        {
            // If it's a countdown clock
            case CLOCKTYPE_COUNTDOWN :
            {
                // Decrease the date 
                m_Date -= DeltaTime;
                
                // Saturate to zero
                if (m_Date < 0.0f)
                    m_Date = 0.0f;
             
                break;
            }

            // If it's a chronometer clock
            case CLOCKTYPE_CHRONOMETER :
            {
                // Increase the date
                m_Date += DeltaTime;

                break;
            }
        }

        // Make a duplicate of the date. It will be used to
        // count progressively the numbers of the clock.
        float RemainingDate = m_Date;

        // All clock numbers to zero, because the update
        // of each clock number will be done by incrementing
        // them repeatedly.
        m_Hours = 0;
        m_Minutes = 0;
        m_Seconds = 0;
        m_Seconds100 = 0;

        // Count the numbers differently according to the
        // clock mode, that allows to know how to count.
        // For a clock mode like HM, the seconds and the
        // seconds100 won't be updated : they will be zero.
        switch (m_ClockMode)
        {
            case CLOCKMODE_HMSC :
                CountHours (RemainingDate);
                CountMinutes (RemainingDate);
                CountSeconds (RemainingDate);
                CountSeconds100 (RemainingDate);
                break;

            case CLOCKMODE_HMS :
                CountHours (RemainingDate);
                CountMinutes (RemainingDate);
                CountSeconds (RemainingDate);
                break;

            case CLOCKMODE_HM :
                CountHours (RemainingDate);
                CountMinutes (RemainingDate);
                break;

            case CLOCKMODE_MSC :
                CountMinutes (RemainingDate);
                CountSeconds (RemainingDate);
                CountSeconds100 (RemainingDate);
                break;

            case CLOCKMODE_MS :
                CountMinutes (RemainingDate);
                CountSeconds (RemainingDate);
                break;

            case CLOCKMODE_SC :
                CountSeconds (RemainingDate);
                CountSeconds100 (RemainingDate);
                break;

            case CLOCKMODE_S :
                CountSeconds (RemainingDate);
                break;
        }
    }
}