#include iostreamusing namespace std;void swapint& a int& b int temp = a; a = b; b = temp;int main int x y; cin x y; cout a= x b= y endl; swapx y; cout a= x b= y
The program takes two integers as input, swaps their values using a swap function, and then prints the new values.
For example, if the input is:
3 5
The output will be:
a=3 b=5
a=5 b=3
原文地址: https://www.cveoy.top/t/topic/h2Tt 著作权归作者所有。请勿转载和采集!