Hey One and All,
My teacher gave us a set of practice problems which are ones with addresses and she wants us to do the math out long hand and give her the answer by writing it out. On the test we will not be able to run it to find the answer. This one is a little tricky since it is a "for" loop, this is a practice problem that she said I could compile and run to get the answer for this practice problem. I have worked and worked on it and I can't see how the math adds up to 53 even though it must because when I run the program that is the output it gives me. Can someone show me how to do this math so I will be prepared for similar type problems?
Thanks!
#include <iostream>
using namespace std;
void result (int v, int& x);
int main ()
{
int t, c;
t = 0;
for ( c = 3; c < 9; c= c + 2)
t = t + 2 * c;
result( t - 4, t );
cout << " t value is " << t << endl;
system ("pause");
return 0;
}//main
void result(int v, int& x)
{
x = ( 3 * v + 5 - x );
return;
}//result