Q1 Hand trace the follwing code include using namespace std
Q1: Hand trace the follwing code:
#include <iostream>
using namespace std;
void find(int& a, int b, int& c,)
int main()
{
int one, two, three;
one = 1;
two = 2;
three = 3;
find(one, two, three);
cout << one << \", \" << two << \", \" << three << endl;
find(two, one, three);
cout << one << \", \" << two << \", \" << three << endl;
find(three, two, one);
cout << one << \", \" << two << \", \" << three << endl;
find(two, three, one);
cout << one << \", \" << two << \", \" << three << endl;
return 0;
}
void find(int& a, int b, int& c)
{
int temp;
c = a * b + 2;
temp = c;
if (b==0)
a = c / (b + 1);
a = a + c – b;
c = b * temp;
}
Solution
#include <iostream>
 using namespace std;
 
 void find(int a, int b, int c)
 int main()
 {
 int one, two, three;
 one = 1;
 two = 2;
 three = 3;
 find(one, two, three);
 cout << one << \", \" << two << \", \" << three << endl;
 find(two, one, three);
 cout << one << \", \" << two << \", \" << three << endl;
 find(three, two, one);
 cout << one << \", \" << two << \", \" << three << endl;
 find(two, three, one);
 cout << one << \", \" << two << \", \" << three << endl;
 return 0;
 }
 void find(int a,int b,int c)
 {
 int temp;
 c = a * b + 2;
 temp = c;
 if (b==0)
 a = c / (b + 1);
 a = a + c – b;
 c = b * temp;
 }


