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

Modify the FACTOR program in this chapter so that it repeatedly asks for a number and calculates its factorial, until the user enters 0, at which point it terminates. You can enclo

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

C Program for MAXIMUM NO, MINIMUM NO AND SORTING   void main() {           int i,j,t;           int a[5];           clrscr();           for(i=0;i

Program which can check the given string is super ascii or not

Expected output of the program: 1. Consider the following programs. For each, indicate whether the program is correct. If yes, what is the expected output? If not, what is the

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec


I need Cryengine Sandbox Speedometer and Tachometer We want to get working Tachometer and Speedometer for a car in latest Cryengine Sandbox. You will find how to make it usin

I have a very confusing assignment and I''m struggling to find the right place to begin or how to break the problem down.