Hi all, I have problems writing a program without the use of arrays.
Q: Write a program that reads integers until end-of-file and then prints the maximum sum of consecutive values. Sample input: 27 6 -50 21 -3 14 16 -8 42 33 -21 9 Sample output: 115 (from sum of integers from 21 to 33) The number of integers given varies, and can be very large. Without using arrays to store previous integer values, and without knowing how many values there are and therefore how many sums to keep track of, I find that kind of difficult to achieve. The most I can get is the sum of all the integers, and the sum of the last 2 integers. Had I been able to use an array, I would have just read all the values into an array and then find the maximum sum using 2 for-loops to permutate all possible combinations of consecutive integers. Please advise. Thank you. Regards, Rayne [Non-text portions of this message have been removed] >-----------------------------------------~-~> CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at http://www.eScribe.com/software/C-Paradise/ >------------------------------------------_-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/C-Paradise/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
