Help with finding lowest value in do while.

Hello, i have this problem that i want to know an answer to it and i can only solve it by using do while and if statement's no array's... :(

so the code look's something like this

#include <iostream>
using namespace std;

int main ()
{
int n=0, min=0;
do{
cout<<"Enter positive number's: "<<endl; //user enter's "x" numbers (1,5,3,2,7,8) and it should output the lowest meaning number 1 in this case
cin>>n;

if(min > n){
min=n;
}
}while(n>0); //but the program won't end until we enter a number below 1

cout<<"Lowest number is: "<<v_min<<endl; //the problem is that it output's the number 0 but it should out put the lowest entered number

return 0;
}


Explained in detail:

If i enter number's 3,2,1 and i end it with number 0, it should out put the number 1 not 0.

How could i fix this, thx for help.
A more complex condition:
If the new value is smaller than the smallest value so far but not too small.


There is also break statement.
See http://www.cplusplus.com/doc/tutorial/control/


Note: your "min" equals 0 before any input. How many positive numbers are smaller than 0?
Topic archived. No new replies allowed.