Insert values in queue - c++ program, C/C++ Programming

Assignment Help:

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;

}


Related Discussions:- Insert values in queue - c++ program

Which constructor gets called while i create an array of , Which constructo...

Which constructor gets called while I create an array of Fred objects?

#title., #quGiven the Array class definition in Fig. 11.10-11.11 (pp. 476-4...

#quGiven the Array class definition in Fig. 11.10-11.11 (pp. 476-479) of the textbook, write a new overloaded operator function for the ‘%’ (modulus) operator (i.e., return an arra

Define a structure in c++, Define a structure in C++: Write a program ...

Define a structure in C++: Write a program a structure in c++ program. void main() {                 struct player                 {                 char name[2

Float number, We can combine more than one variable on the same line i.e. ...

We can combine more than one variable on the same line i.e.   float number1,number2,number3; etc Sometimes we want to mix the variable types used on the same line, this could

Explain structures, Structures A structure is a derived data type. It i...

Structures A structure is a derived data type. It is a combination of logically related data items. Unlike arrays, which are a collection of such as data types, structures can

Looping, #questiStarting with a blank solution, write a program to prompt t...

#questiStarting with a blank solution, write a program to prompt the user for an employee number, hourly rate and hours worked. Compute and display the employee number, gross weekl

Optimized nic driver for windows compact 7, Optimized NIC Driver for Window...

Optimized NIC Driver for Windows Compact 7 for Hard Real Time Communication Project Description: I am seeking an optimized driver (miniport driver) that will be used for sele

Decode the code, Smugglers are becoming very smart day by day. Now they hav...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd