Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ PLEASE HELP




On Oct 28, 2006, at 8:44 PM, valery gaulin wrote:

Can somebody help me out with this c++ program that I am writting for my first c++ course.
Basically this assignment ask us to create an array from the user and build some function find max, min, sum, etc. My code seems to be fine in my main program but it does not cout these line:

The purpose of this list isn't really to give c++ help.

cout<< " The array is : ";
print(a,i);

and it always cout min=0 at this line, wich it should give me the smallest value:

cout<< "The minimum value index position is: " << find_minimum (a,i,min) << " and the number is: " << min << endl;

Is it possible that the compiler xcode as some defect or is it me that is making a mistake? I attach my program and here are the output from my program when I enter some integer. Please some one answer me, because I really don't understand what is wrong.

The min always being zero issue has to do with order of evaluation. Someone recently told me that the order in which the operands to an operator are evaluated is undefined in c++. In this case, min is initialized to zero and is likely being evaluated before find_minimum () is.



-- Steve Checkoway



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >C++ PLEASE HELP (From: "valery gaulin" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.