#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void swap(int *a,int *b)
{
int c;
c=*a;
*a=*b;
*b=c;
}
void swap(float *a,float *b)
{
float c;
c=*a;
*a=*b;
*b=c;
}
void swap(double *a,double *b)
{
double c;
c=*a;
*a=*b;
*b=c;
}
void main()
{
int a,b;
float c,d;
double e,f;
clrscr();
cout<<"enter the values of a,b for integer";
cin>>a>>b;
cout<<"enter the values for c,d ";
cin>>c>>d;
cout<<"enter the values for e,f ";
cin>>e>>f;
void swap(int *,int *);
void swap(float *,float *);
void swap(double *,double *);
swap(&a,&b);
swap(&c,&d);
swap(&e,&f);
cout<<"\nafter swaping ";
cout<<"\nvalues of a,b "<<a<<"\t"<<b;
cout<<" \nvalues of c,d "<<c<<"\t"<<d;
cout<<"\nvalues of e,f "<<e<<"\t"<<f;
getch();
}
#include<iomanip.h>
#include<conio.h>
void swap(int *a,int *b)
{
int c;
c=*a;
*a=*b;
*b=c;
}
void swap(float *a,float *b)
{
float c;
c=*a;
*a=*b;
*b=c;
}
void swap(double *a,double *b)
{
double c;
c=*a;
*a=*b;
*b=c;
}
void main()
{
int a,b;
float c,d;
double e,f;
clrscr();
cout<<"enter the values of a,b for integer";
cin>>a>>b;
cout<<"enter the values for c,d ";
cin>>c>>d;
cout<<"enter the values for e,f ";
cin>>e>>f;
void swap(int *,int *);
void swap(float *,float *);
void swap(double *,double *);
swap(&a,&b);
swap(&c,&d);
swap(&e,&f);
cout<<"\nafter swaping ";
cout<<"\nvalues of a,b "<<a<<"\t"<<b;
cout<<" \nvalues of c,d "<<c<<"\t"<<d;
cout<<"\nvalues of e,f "<<e<<"\t"<<f;
getch();
}
ALGORITHM PLEASE................................................
ReplyDeletei will send you. please send me your email or skype id
ReplyDeletethis link might be help you C program to swap two numbers
ReplyDeletehttp://programmergallery.com/c-program/c-program-swap-two-numbers.php
why shud we use pointers
ReplyDeleteNice..
ReplyDeleteWrong one
ReplyDelete