View Single Post
Join Date: Oct 2006
Posts: 164
Reputation: Barefootsanders is an unknown quantity at this point 
Solved Threads: 3
Barefootsanders Barefootsanders is offline Offline
Junior Poster

Re: finding the smallest number

 
0
  #3
Nov 12th, 2006
try something like this. because you are limited to while/if loops its kinda of primitive but it should work.
  1. int i=0;
  2. temp=0;
  3. cin>>Nitems>>endl;
  4. while(i<(number of items)){
  5. cin>>number>>endl;
  6. if(number>temp)
  7. number = max;
  8. i++;
  9. }

putting that into a function and make it return max should get you what you want.
Last edited by Barefootsanders; Nov 12th, 2006 at 11:23 pm.
Reply With Quote