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
Integer literal Integer is numbers without fractional parts. e.g. 20       // Decimal 024      // Octal     0x14     // Hexadecimal To indicate long, unsigned,

What if one forget the [] when deleteing array allocated through new T[n]? A: All life comes to a disastrous end. It is the programmer's responsibility not the compiler's to

Explain Object-oriented programming Object-oriented programming (OOP) attempts to meet these requirements, providing methods for managing enormous complexity, achieving reuse o

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.

within 2 mins give me answer pllzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

Make the following 3 functions work by filling in appropriate C code. This file 1. // Write a function to count the number of particular characters in a string. // Do not use a

Explain one-definition rule (ODR). According to one-definition rule, C++ constructs should be identically defined in each compilation unit they are used in. As per ODR, two


Two kinds of line detection are implemented in OpenCV, the Hough Transform and the probabilistic Hough transform. Assume that there are n feature points in an image and that it tak

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome