Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Tracing Homework

tracing homework

  • Please log in to reply
1 reply to this topic

#1 ewilson

ewilson

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts
  • Programming Language:C, C++
  • Learning:C, C++

Posted 03 October 2012 - 12:37 PM

I need to trace this program for homework, im quite confused.

void mickey(int &a, int b, int &c);
void minnie(int u, int &v, int w);
void pluto(int m, int n, int p);

int main()
{
	 int num1 = 8, num2 = 3, int num3 = 6;
	 mickey (num1, num2, num3);
	 pluto (num3, num1, num2);
	 minnie (num1, num2, num3);
	 pluto(num3, num1, num2);

	 system ("pause");
	 return 0;

}

void mickey(int &a, int b, int &c)
{
   int first;

   first = b+15;
   a = 2 *b;
   b = first +6;
   c= a+b;
   return;
}

void minnie (int u, int &v, int w)

{
   int second, x;

   second = u;
   v = second +2
   x = u + v;
   w = v / x;

  return;
}

void pluto (int m, int n, in p)
{
	cout << m << endl;
	cout << p << endl;
	cout << n << endl;
	return;

}

  • 0

#2 neil

neil

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 373 posts
  • Location:Philadelphia
  • Programming Language:C++, Perl, Bash
  • Learning:C, Java, C++, Python, JavaScript, Perl, Bash, Others

Posted 03 October 2012 - 01:18 PM

Which part are you confused about?
Read up on function calls and arguments (including call by reference).
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download