insert values in queue - c programwrite a program


Insert values in queue - C++ program:

Write a program to insert values in queue.

int main()

 

{

 

 

    int k;

    Queue timeLine;

    cout << "\nSampling";

    for( int i = 0; i < 7; i++ )

                {

                struct time snapShot;

                gettime( &snapShot );

                Time sample( snapShot.ti_hour,

                                     snapShot.ti_min,

                                     snapShot.ti_sec,

                                     snapShot.ti_hund );

                timeLine.put ( *(new Time( sample )) );

                cout << ".";

                randomize();

                k = rand();

                for(int j = 0; j < k; ++j )  // Delay loop

                     {

                     cout << "";

                     }

                }

    cout << "\nThe timing samples are:\n\n";

    while( !timeLine.isEmpty() )

                {

                Time& sampleTime = (Time&)timeLine.get();

                cout << sampleTime << "\n";

                delete &sampleTime;

                }

    return 0;

}

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: insert values in queue - c programwrite a program
Reference No:- TGS0174867

Expected delivery within 24 Hours