Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Define and implement a swap function whichhas three arguments. In main(), def

ID: 3613750 • Letter: 1

Question

1. Define and implement aswap function whichhas three arguments. In main(), define three variables and assigntheir values through standard input (cin), call the swap functiondefined above to swap their values, then output A, B, and C’svalue within main() to check the difference (e.g. arguments are: a,b, c with values 4, 5, and 6 respectively, after calling swap(), akeeps b’s value 5, b keeps c’s value 6, and c keepsa’s value 4).

Note: defines thearguments using referenceto swap correctly

2. In main(), declare avariable N, input an integer lessthan 10 from standard input (keyboard). Then, define afunction Functo calculate the factorial product of N,which is:

Func(N) = 1/N*2/N*3/N*4/N*…*(N-1)/N*N/N;

For example, if you enter 3, yourprogram will calculate 1/3*2/3*3/3 = 0.222222

Note:the variables in this program should be defined asdouble.N will be used as anargument of the function. You are required to use a loop (for orwhile) to calculate the result. Finally, return the result tomain() function, and output the result in main().

Explanation / Answer

1) SWAP #include using namespace std; /* Exchange the values by pointers. */ void swap(int *i, int *j, int *k) {    int temp;    temp = *i;    *i = *j;    *j = temp;    temp = *j;    *j = * k;    *k = temp; } int main(void) { int num1, num2, num3; coutnum1; cout