loop to get greatest and least number, its not working please help
I can not seem to get this program to work, I am having no luck with loops for anything, very lost. This is my latest attempt and it is not working. Any help I can get would be greatly appriciated. Thank you in advance.
Code:
// This program should use a loop that lets the user enter a series of integers.
// The user should enter -99 to signal the end of the series.
// After all the numbers have been entered,
// the program should display the largest and smallest numbers entered.
#include <iostream?
using namespace std;
int main()
{
//enter up to 5 integers
int least, int greatest; //determine least and greatest
double num1 = 0;
double num2 = 0;
double num3 = 0;
double num4 = 0;
double num5 = 0;
cout << " Please enter up to 5 integers:\n ";
cin >> num1, num2, num3, num4, num5;
cout << " The integer with the least value is: \n";
cin >> least;
cout << " Of the integers you choose the one with the greatest value is: \n"
cin >> greatest;
if ( num1 < num2 )
least = num1;
else if ( num2 < num3)
least = num2;
else if ( num3 < num4)
least = num3;
else if ( num4 < num5)
least = num3;
else if ( num 5 < num1 )
least = num5
if ( num1 > num2 )
greatest = num1;
else if ( num2 > num3)
greatest = num2;
else if ( num3 > num4)
greatest = num3;
else if ( num4 > num5)
greatest = num3;
else if ( num 5 > num1 )
greatest = num5
if( user input == -99 ) break;
return 0;
}