Program for swapping the two integers, C/C++ Programming

Program for Swapping the Two Integers

                For example, Swapping the two value

                                int x=4,y=6,t;

                                t=x;

                                x=y;

                                y=t;

                Similarly,

void Rolodex::insertAfterCurrent(const std::string& str)

{

       RolodexItem* t = current->next;     

       t->prev = current->next = new RolodexItem ();                               

       current->next->prev = current;                                                            

       current->next->next = t;                                                                

      current->next->value = str;                                                             

      current = current->next;                                                         

}

t = current->next 

set the next position of the pointer

 t->prev= new RolodexItem ();

Initiate the previous position into RolodexItem Object

current->next->next = t;

Set the next of current Next RolodexItem Object into t

Here, t (temporary) is used to change the position of the RolodexItem Object

Posted Date: 3/1/2013 7:27:02 AM | Location : United States







Related Discussions:- Program for swapping the two integers, Assignment Help, Ask Question on Program for swapping the two integers, Get Answer, Expert's Help, Program for swapping the two integers Discussions

Write discussion on Program for swapping the two integers
Your posts are moderated
Related Questions

Intelligent homes are becoming increasingly popular as the cost/performance ratio of microcontrollers is continuously dropping.  These systems incorporate various transducers to de

Describe Processing an array? The Single operations which involve complete arrays are not permitted in C language. therefore if a and b are similar arrays (for example same dim

Using Figure 10.2 as a model, illustrate the result of each operation in the sequence ENQUEUE.Q; 4/, ENQUEUE.Q; 1/, ENQUEUE.Q; 3/, DEQUEUE.Q/, ENQUEUE.Q; 8/, and DEQUEUE.Q/ on an i

Define How Passing Arrays to a Function? A complete array can be passed to a function as an argument. The manner in which the array is passed be different from that of an ordin

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

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

Introduction to Classes Object-oriented programming (OOP) is a conceptual approach to design programs. It can be executed in many languages, whether they directly support OOP c

For the circuit shown in Figure, verify (a) the battery voltage V , (b) the total resistance of the circuit, and (c) the values of resistance of resistors R 1 , R 2 and