can anybody please give me a working swap program
i need a swap program with the following things
Write a procedure that takes in two integer parameters, named value1 and value2. The procedure must swap their values. The main body of the program should read in two integer values from the user, print the values with their variable names, swap the values (using your swap procedure), and print the values again. Write a unit test to check that this procedure works; this test should use the
following pseudo-code.
a. Declare variables x and y as Integers
b. Set x to -1
c. Set y to 1
d. Call Swap(x,y)
e. Check that x = 1
f. Check that y = -1
Comments
:
: i need a swap program with the following things
:
: Write a procedure that takes in two integer parameters, named value1 and value2. The procedure must swap their values. The main body of the program should read in two integer values from the user, print the values with their variable names, swap the values (using your swap procedure), and print the values again. Write a unit test to check that this procedure works; this test should use the
: following pseudo-code.
: a. Declare variables x and y as Integers
: b. Set x to -1
: c. Set y to 1
: d. Call Swap(x,y)
: e. Check that x = 1
: f. Check that y = -1
:
Here is a part:
[code]
procedure Swap(var x, y: integer);
var
t: integer;
begin
t := x;
x := y;
y := t;
end;
[/code]
The rest is up to you.
: :
: : i need a swap program with the following things
: :
: : Write a procedure that takes in two integer parameters, named value1 and value2. The procedure must swap their values. The main body of the program should read in two integer values from the user, print the values with their variable names, swap the values (using your swap procedure), and print the values again. Write a unit test to check that this procedure works; this test should use the
: : following pseudo-code.
: : a. Declare variables x and y as Integers
: : b. Set x to -1
: : c. Set y to 1
: : d. Call Swap(x,y)
: : e. Check that x = 1
: : f. Check that y = -1
: :
: Here is a part:
: [code]
: procedure Swap(var x, y: integer);
: var
: t: integer;
: begin
: t := x;
: x := y;
: y := t;
: end;
: [/code]
: The rest is up to you.
:
thank you soo much buddy ur a genius