Christos
  • Christos
C++, Can you please tell me how can I display the smallest variable in an array ? MY CODE: while (counter < 9){ if (B[i] < B[i+u]) i++; else if (B[i+u] < B[i]){ B[i] = B[i+u]; } counter++; }
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
Christos
  • Christos
MY NEW CODE: while (counter < 9){ if (B[i] <= B[u]) u++; else { B[i] = B[u]; u++; } counter++; }
e.mccormick
  • e.mccormick
That solution I did for the other problem you had would work. Just set your test variable to the first one then loop through. Also, a sort could work. Then reurn the 0th element of the sorted array.
Christos
  • Christos
What is a sort ? Can you please give me an example of how to code something that finds the smallest variable?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

e.mccormick
  • e.mccormick
Have the link to the solution I shared for your last problem?
e.mccormick
  • e.mccormick
temp=array[0] loop through array if temp>array[iter] temp = array[iter]
Christos
  • Christos
FIXED !!!!! Thanks a lot bro !! :) while (counter < 9){ if (B[i] <= B[u]) u++; else { i++; B[i]=B[u]; u++; } counter++; }
e.mccormick
  • e.mccormick
Looks like you are doing a sort. Well, that works.

Looking for something else?

Not the answer you are looking for? Search for more explanations.