Ok, this is not a syntax problem, but rather a structural problem.
I have this array (with values put in by the user) of binary numbers and I need to change the entire thing into a normal number.
Here's the function I made to change the values after the user inputs them.... syntax is correct, however, I think the result given might not be the thing I want. I'm not even sure what it gives :huh:
int conversion (int [])
{
int T; //declaration of T so I can bypass some error...
for (int i=0; i<=40; i++) //moving within each value of the array
{
if (int = o) //binaries... 1 or 0
M = 0;
else
int M = 1*pow(2,i) + 1*pow(2, i+1); //1 times 2 to the power i = conversion from binary to normal value. sum is for adding the next part
for (int u=0; u<=39; u++) //parallel computations, the first part so I can make a copy of M unchanged( variable n), and then change M
// and add it to it's original value M. notice the difference in the counters
{
int N = 1*pow(2,i) + 1*pow(2, i+1); //i is from the previous counter
int C = M+N;
int T=C+N;
} //end 1st for
} //end 2nd for
cout<< T;
} //end user defined function
Halp guise please!
Bookmarks