Hello,
I'm having some problems with trying to get my random numbers to go in ascending order and descending order as well and trying to figure out how to get when I put in a number between 2 - 25 how to get the highest number out of the random pick as well as the lowest number out of the random pick. Can someone please help!?!?!?!?! I greatly appreciate it if someone could help me out on this! :)
Below is my code I have so far...
Thanks,
ethompson
#include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;
void bubbleSort (int Rand[]);
main()
{
cout<<"Data Searching and Sorting!!"<<endl<<endl;
srand(time(0));
int Rand_Num;
int Input;
char ans;
int cnt, inside, outside, Swapped, tmp;
int high, low;
do
{
cout << "How many numbers would you like to be generated (2 - 25): ";
cin >> Input;
if(Input >= 2 && Input <= 25)
{
cout<<"The "<<Input<<" numbers genterated are: "<<endl;
for(int i = 0; i < Input; i++)
{
Rand_Num = (rand() % 47) + 1;
cout <<Rand_Num<<endl;
}
}
else
cout<<"Sorry, that is invalid try again"<<endl;
//______________________________________________________________________________
cout<<"The Highest Number is: "<<high<<endl<<endl<<endl;
cout<<"The Lowest number is: "<<low<<endl<<endl<<endl;
//______________________________________________________________________________
void bubbleSort(int Rand, 25);
cout<< "After sorting, the list elements are: "<<endl;
int i;
for (i = 0; i<25; i++)
cout<<Rand_Num<<" ";
cout<<endl;
cout<<"Want to pick again? ";
cin>>ans;
cout<<endl<<endl;
}
while((ans=='y') || (ans=='Y'));
cin.get();
cin.get();
return 0;
}