C++ program to swap the values of two variables if values of both variables are not the same

Write a C++ program to swap the values of two variables if values of both variables are not the same using a switch statement

e.g

before swapping : a=5; b=6

after swapping:  a=6, b=5

logic of swaping program

Flowchart of the program to swap the values of two variables using the switch statement

C++ program to swap the values of two variables if values of both variables are not the same

C++ Source Code to swap the values of two variables using the switch statement

Output

Please input the value of a :

6

Please input the value of b :

9

After Swap

a: 9

b: 6

SFT (Shamil’s Flow Table )

Are you interested to Read about SFT(Shamil’s Flow Table)?

Explanation of the program to swap the values of the variables using the switch statement

Latest posts by Prof. Fazal Rehman Shamil (see all)

Buy advertisement space on T4Tutorials

For more details email [email protected]