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
I need the c++ program of class bank accout including balance,rate of interests

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

A: The answer to this lies actually, how they used. Along ++i(PreIncrement) the variable is incremented and new value is returned. Thus it needs one instruction to increment the va

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



The code contains two built-in pitfalls. First one, if it executes in a member function for an static, extern or automatic object, the program will possibly crash as soon as the de

A: Depends. Might be "zero" Objects which are thrown must have a publicly accessible copy-constructor. The compiler is permitted to generate code which copies the thrown object

C Program for FUNCTION OF COPY ONE STRING IN OTHER STRING #include stdio.h> #include conio.h> int copy(char a[],char b[]); void main() {           char a[100],b[

Aim: To implement a program to handle stack overflow, underflow and odd number exception using Exception Handling. Code: #include #include #include #define MAX