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 help with virtual memory manager implementation in C

need to create c++ classes to store all pascal types in compiler design.

Aim: To implement program to calculate area of cube using inline function. Code: inline void area_cube(float side) {             float area;             are

A body which has three forces acting on it is in equilibrium. One force is 3N to the North and the other is 4N to the west. What us the magnitude and direction of the third force?

Insert values in queue - C++ program: Write a program to insert values in queue. int main()   {         int k;     Queue timeLine;     cout     for(

The for Loop For loop is the controlled form of loop. The general format of this : for( initialize ; test ; update)                  {                     statements;

Constructor public class ListNode {    // package access members; List can access these directly private E data; // data for this node privateListNode nextNode; /

Asks the user for an integer. if the number is less than 21, ask them for a number again; repeat this until you get a number bigger than 20. 20 is not an acceptable number. Once yo

Write algorithm and program for the conversion of a Tree to a Binary Tree

Defines the entry point for the console application. // #include "stdafx.h" #include #include #include"conio.h" using namespace std; double Determinant(double a[][3],int forde