Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - A C++ programming problem, the variable exchange function swap () is defined, and two integer variables exchange data and then output.
A C++ programming problem, the variable exchange function swap () is defined, and two integer variables exchange data and then output.
# include & ltiostream.h & gt

Invalid swap (interest and interest. I. int & ampb)

{

int c;

c = a;

a = b;

b = c;

}

void main(){

int x,y;

Cout & lt& lt "Please enter two integers:"

CIN & gt; & gtx & gt& gty;

swap(x,y);

Cout & lt& lt "Output result after exchange:";

cout & lt& ltx & lt& lt" " " & lt& lty;

cout & lt& ltendl

}