Write a program in C++ to scan two numbers, display their contents. Perform swapping of their values and then again display their contents.
Write a program in C++ to scan two numbers, display their contents. Perform swapping of their values and then again display their contents.
# include <iostream>
using namespace std;
int main(){
float a, b, c;
cout
<< "Enter
Number in a"
<< endl;
cin
>> a;
cout
<< "Enter
Number in b"
<< endl;
cin
>> b;
cout
<< "Befiore
Swapping "
<< endl;
cout
<< "a hold
vlaue "
<< a<< endl;
cout
<< "b hold
vlaue "
<< b << endl;
c = a;
a = b;
b = c;
cout
<< "After
Swapping "
<< endl;
cout
<< "a hold
vlaue of b "
<< a<< endl;
cout
<< "b hold
vlaue of a "
<< b << endl;
system("pause");
return 0;
}
Comments
Post a Comment