I want a user to be able to enter 5 numbers and I want the maximum number to be displayed (and it must tell the user whether this is the 1st number, 2nd number, 3rd number (etc..) that was entered)

Example:
15 45 3 79 20

The maximum number is 79 and it is the 4th number.

Here is some code I started with, I am a beginner. Thanks for all the help. I appreciate it.

#include "stdafx.h"
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

//-------------------------------------------------------------

int main ()
{
	const int MAXNUMS = 5;
	int count;
	char num1, num2, num3, num4, num5;
	double max;

	cout << "This program will output the maximum value of 5 numbers entered.\n";
	cout << "Please enter ";
	cout << MAXNUMS << " numbers between 1 and 100.\n";
	count = 5;

	for (count = MAXNUMS; count < MAXNUMS;)

		cout << "\nEnter 5 numbers: ";
		cin >> num1, num2, num3, num4, num5;
		cout << "The maximum number is: ";
		cout << max(num1);


	return 0;
}

there are errors in places and the structure is messed up. like I said, I am a beginner. Help is very appreciate. im trying to learn here. the books don't help... experience will.

I'd start by using an array instead of N separate variables. What you're doing makes it difficult to handle the list elegantly. As for your code, it's very screwed up. ;) Here's the pseudocode for your problem:

constant N := 5

numbers [0..N] of integer

# Load the numbers
for i := 0 to N do
  read numbers[i] from stdin
loop

largest as integer := numbers[0]

# Find the largest
for i := 1 to N do
  if numbers[i] > largest then
    largest := numbers[i]
  endif
loop

# Show the numbers
print "The numbers are: " to stdout

for i := 0 to N do
  print numbers[i] to stdout
loop

# Show the largest
print "\nThe largest was: ", largest to stdout

This pseudocode can easily be translated to C++, but you'll have to take care and use your reference if you're not familiar with C++ syntax (as seems to be the case). Get that working and then we'll see about improving your code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.