+ 1
using class swap two numbers without using third variable
2 ответов
0
yes... w not....
0
#include<iostream>
using namespace std;
int main()
{
int a, b;
cout<<"Enter n. to A and B"<<"\n";
cin>>a>>b;
cout<<"\n"<<"Before Value"<<"\n"<<"A="<<a<<"\n"<<"B="<<b;
a+=b;
b=a-b;
a-=b;
cout<<"\n"<<"After Value"<<"\n"<<"A="<<a<<"\n"<<"B="<<b;
return 0;
}