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

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;

}

Posted Date: 10/19/2012 3:03:40 AM | Location : United States







Related Discussions:- Insert values in queue - c++ program, Assignment Help, Ask Question on Insert values in queue - c++ program, Get Answer, Expert's Help, Insert values in queue - c++ program Discussions

Write discussion on Insert values in queue - c++ program
Your posts are moderated
Related Questions
Mixed Mode Expressions and Implicit type Conversions A mixed mode expression is one in which the operands are not of the similar type. In this case, the operands are converted

Define Four Facilities Provided by C Language Preprocessor? The C language preprocessor provides four separate facilities that you can use as you see fit:   Inclusion

Pupils' heights The health visitor at a school is going to measure the heights of all pupils. For each class she makes a statistics giving the number of pupils of each height and

This is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca

steric in square

The Malt Shop restaurant charges $2.99 for burgers, $1.29 for fries, and $1.25 for sodas.  Write a program that allows a restaurant employee to enter an order (the number of bur

Rewrite the recursive bisection root finding function from lecture to be iterative (using a while loop). The function declaration should be root = bisectIter(f,a,b,tol). The input

Many modern cryptography algorithms require two numbers that are coprime, or sometimes referred to as relatively prime. Two numbers are coprime if their greatest common divisor is

Stack operations - C++: Write a program to define basic stack operations in c++. int Stack::push(int elem) {    int m = getmax();    if (top    {       put_

define a class for student