|
From: Per W. <pw...@ia...> - 2004-06-27 21:32:44
|
You loadthe first integer into min_so_far.
However, your for loop should _not_ use min_so_far as max, and you
shouldn't input the total count into i but into num...
How about trying to read your own code, and think a bit if it makes
sense... If you compile your code with full warnings (-Wall) the compiler
would probaby give you a couple of warnings.
By the way, you have one int i directly inside main() but declare a new
int i inside the for().
/Per W
On Sun, 27 Jun 2004, PETER CAMPOS wrote:
> hi everyone..freshman cpp needs help again
> i want this program to request for any number of integers to be compared for the lowest integer. thanx for your time. peter
>
> #include <iostream>
> using namespace std;
>
> int main (){
> int num, i, min_so_far;
> cout << "How many numbers do you want to compare: ";
> cin >> i;
> cout << "enter the numbers to be counted: ";
> cin >> min_so_far;
> for (int i=0; i<min_so_far; i++)
> {
> cout << "enter number: ";
> cin >> num;
> if (num < min_so_far)
> min_so_far = num;
> }
> cout << "the minimum is " << min_so_far << endl;
> return 0;
> }
>
>
> ______________ ______________ ______________ ______________
> ccny.cuny.edu
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> digital self defense, top technical experts, no vendor pitches,
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|