This is in C++. I am confused on what part of the code to put in the swap.h, swa
ID: 3593272 • Letter: T
Question
This is in C++. I am confused on what part of the code to put in the swap.h, swap.cpp, and hw03_1.cpp
1. Separate Compilation Split the following program into three source files: awap, h, awap.cpp, and hw03_1.app, such that awap. h contains the function prototypes (Note: make sure to include #ifndef, #define, and #endif preprocess directives). The file swap. cpp should contain the function implementations, and the file hw03_1.cpp should contain the main function. a. #include 3 void get numbers (inti, int&); 4 void swap values (inti, intk) 5 void show results (int, int) 7 int main int first num, second num 10 get numbers (first num, second _num) swap values (irat num, second _num) show results (first_nu, second nun) return 0 12 13 14 15 16 void get numbera (inti inputi, int& input2) ( using nameapace atd cout inputi >> input2; 18 19 20 21 22 void swap_values (inti variablel, int& variable2) 23 24 temp=variable1; int temp variable1 = variable2 ; variable2temp 2E 27 28 29 void show _esults (int outputi, int output2) 30 31 32 33 ) using namespace std coutExplanation / Answer
**This is how the code is splitted
swap.cpp
#include<iostream>
void swap_values(int& variable1, int& variable2){
-----
-----
}
void get_numbers(int& input1, int& input2){
------
------
}
void show_results(int output1, int output2){
----
----
}
swap.h
void get_numbers(int&, int&);
void swap_values(int&, int &);
void show_results(int, int)
hw03_1.cpp
#include<iostream>
#include "swap.h"
int main(){
----
-----
}
---- ->indicates the code of the function
**Comment for any further queries. Upvote if the answer is satisfactory.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.