C program to swap the two values, C/C++ Programming

Program is to swap the two values which are enter by user:

Program is to swap the two values which are enter by user through the function with values changed using pointers

void swap(int *p,int *q);

void main()

 {

 clrscr();

 int a,b;

 cout<<" enter the number ";

 cin>>a;

 cout<<" enter the number ";

 cin>>b;

 swap(&a,&b);

 cout<<" the numbers after the value being changed "<<"\n"<

 }

 

void swap(int *p,int *q)

 {

  int r;

   r=*p;

  *p=*q;

  *q=r;

 }

Posted Date: 10/19/2012 7:59:31 AM | Location : United States







Related Discussions:- C program to swap the two values, Assignment Help, Ask Question on C program to swap the two values, Get Answer, Expert's Help, C program to swap the two values Discussions

Write discussion on C program to swap the two values
Your posts are moderated
Related Questions
I need Computer application/program. Project Description:                                                                I want a project done. It is a computer desktop appli


Hi is there any chance to get assignment for fresher tutor

assume that the first integer read with cin specifies the number of values remaining to be entered. that program should read only one value each time cin is executed .a typical inp

Purpose This assignment is an exercise in implementing the queue ADT using a singly-linked list. This assignment also introduces the concept of templates. Assignment Th

to compute the net pay of an emplyee, given his/her pay rate, number of hours and tax rate

Write a program to input two integers. If they are equal display "The numbers are equal". Otherwise display a message if the first is a multiple of the second or if it is not a mul

How to write a global inline function First, let's get away from member functions for a moment and consider a global function.  To make a request that this function be in line:

Pupils' heights The health visitor at a school is going to measure the heights of all pupils. For each class she makes a statistics giving the number of pupils of each height and

Program is to store all ASCII char into a file: void main()     {   ofstream  fout("ascii.txt");   int i,n=256;   for(i=1;i     {     fout     }