View Single Post
Join Date: Nov 2006
Posts: 3
Reputation: mcweezle is an unknown quantity at this point 
Solved Threads: 0
mcweezle's Avatar
mcweezle mcweezle is offline Offline
Newbie Poster

Re: finding the smallest number

 
0
  #9
Nov 13th, 2006
Originally Posted by joeprogrammer View Post
You still haven't initalized temp2.

By the way, here's what I think it should look like:
  1. temp2 = -99;
  2.  
  3.  
  4. while (number != SENTINEL)
  5. { // open while 3
  6. counter++;
  7. cin >> number;
  8.  
  9. if (number == -99) {
  10. break;
  11. }
  12. if (number < temp2 || temp2 == -99)
  13. temp2 = number;
  14. }
Probably not the best way of doing it, but it works.

Hey! that works! I had something very similar to that at one time, but I had temp2 != -99.... I turned your code into this and it failed. Turned it back and it worked... that one little ! symbol. geez!

Thanks guys! I appreciate the assistance!
Last edited by mcweezle; Nov 13th, 2006 at 1:25 am. Reason: giving thanks
Reply With Quote