954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

finding the maximum and minimum

I am mingle with my CS labs to find the solution of how to find the maximum and minimum number of a entered numbers,can anyoe help me

note "no function and array required to manipulate data in our lab";

penty
Newbie Poster
1 post since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

Imagine you have a stack of papers in front of you, each with a number written on it. They are in no particular order. You can only pick up one sheet at a time, the one on top.

How would you find the largest and smallest of the numbers in the pile, and at any moment, if interrupted, be able to state which is the highest and lowest number you've found so far?

Consider also the case that there happens to be only one piece of paper on the stack.

Now do this in C++ code.

vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You