C++ programming to swap two numbers with temp local variable

Опубликовано: 25 Июль 2026
на канале: RioProfessor Liu
309
4

Swapping Numeric Values

Example program (next slide) takes in two integers, swaps them if first is greater, and then prints out lower number, followed by higher number
Uses single-alternative selection structure with statement block in true path
Creates temporary variable to accomplish swap
Temp variable can only be used in statement block in which it is declared; called a local variable