2:00 Module 9 Lab 6 Detail Grade Lab 6 No due date Part 1 We\'ve seen two ways w
ID: 3920658 • Letter: 2
Question
2:00 Module 9 Lab 6 Detail Grade Lab 6 No due date Part 1 We've seen two ways we can write a function that swaps the values of two int variables: one way passes the ints by reference, the other way passes the addresses of those ints. Write a swap function that uses both - it should pass one int variable by reference, and should pass the address of the other int variable, and the function should then swap those two values. Write a main function that declares and initializes two int variables, calls your swap function, and then prints out the two variables, showing that their values were correctly swapped Part 2 Write a class called Mylnt that has an int- pointer data member. It should have the follewing methode Previous Next Calendar To Do InboxExplanation / Answer
#include using namespace std; void swap(int &n1, int *n2) { int temp = n1; n1 = *n2; *n2 = temp; } int main() { int n1 = 3, n2 = 5; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.