
display numbers in order
Hi I am working on a program that is supposed to have the user enter three number between 5 and +5. then the program puts the numbers in order by least to greatest order. here is what i have so far. thanks for any help!
#include "stdafx.h"
#include <iostream.h>
int a;
int b;
int c;
int main(int argc, char* argv[])
{
cout<<"Enter in Three Numbers between 5 and +5\n";
cin>>a;
cin>>b;
cin>>c;
if(a < 5  a >= +6)
{
cout<<"Numbers do not fall within range\n";
return 0;
}
if(b < 5  b >= +6)
{
cout<<"Numbers do not fall within range\n";
return 0;
}
if(c < 5  c >= +6)
{
cout<<"Numbers do not fall within range\n";
return 0;
}
if(a<b && a<c)
if(b>a && b<c)
if(c>a && c>b)
if(b<a && b<c)
if(c>a && c<b)
if(a>b && a>c)
cout<<a<<b;
return 0;
}

Try something like this to get your data
int nNumber[3] ={0}
for(int i = 0; i < 3;i++)
{
place the input in nNumber array and check each input for ranges
}
Now call a function that takes a pointer to an int and call it with nNumber. Look around for some information on a bubble sort. Use that on your array in this function.
Upon return from the previous function iterate the array printing out the numbers in order. Sorta like what you did to get the data into the array.
Let me know if you have any questions.

yeah dude defently use an array it will be much easier...