Question: Write a macro and a program for swapping the contents of two variables. The macro should have three parameters: the two variables and the

Write a macro and a program for swapping the contents of two

 

Write a macro and a program for swapping the contents of two variables. The macro should have three parameters: the two variables and the corresponding data type. Your program should read two integers and two floats from the standard input. Then you should print on the standard output the contents of the four variables after swapping (floats with a floating point precision of 6). You can assume that the input will be valid. Your solution has to satisfy the requirements from the problem description and has to pass the following testcase and potentially other testcases which are uploaded. All characters are relevant for passing testcases including newlines and spaces. Testcase 6.1: input Testcase 6.1: output 1 2 3.45 5.677 After swapping: 2 1 5.677000 3.450000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!