Here's how you should approach it.
Code:
- Put the computer aside for the moment, and grab a pen and paper
- Solve the problem by hand, keeping note of each step you must take
- Do this a few times until you have a list of steps to follow
- Open your source file
while(!complete)
{
- Write a few lines of code to do just one thing
- Compile and run this code to ensure it is doing what you expect
}
My recommendation: Start with the "5 input" variation first, this will be easier.
Step 1: Write the basic framework of the program (which you have in your first post, but don't include the "for()" loop).
Step 2: Write a loop that simply receives user input and places it into your array, and loop it 5 times. Compile and verify there are no errors or warnings.
Step 3: Write a loop that prints each element of that array, so you can see the results. Even if you don't require this output as part of your program, it will help you verify that your code is working as expected. (Coding is like constructing a building, in that it often requires the assembly of temporary "scaffolding" to help achieve the main goal). Compile and verify there are no errors or warnings.
Step 4: Write the code that searches for the largest number, and prints it out. Compile and verify there are no errors or warnings.
Step 5: Write the code that searches for the smallest number, and prints it out. Compile and verify there are no errors or warnings.
Take it step by step. If you get stuck, feel free to ask additional questions - ensure that those questions are specific if you want good, specific answers.