Storing random number in array(sequential search & bubble sort)
i have generate random number, 1 - 20, such a sequence may or may not contain duplicates. Print each number as it is generated, and store it in an array, but only if it is not a duplicate of a number already stored.
Code:
for(int i=0;i<20;++i) {
randomInt=rand()%20+1;
cout<<randomInt<<endl; // print each number
MyRand[i]=randomInt; //how to store all unique number
// (no duplicates in a one-dimensial array
// (use sequential search)
// - Use a function to search the existing array
}
// After you have created the array, print it along with its
// actual size - Use a function to print the array.
// Then print the array again, this time in sorted in increasing
//order - Use a function to sort the array (use bubble sort)
Please can anyone guide me into successfull coding. I need this ASAP, coz the due date is near. Please help, i am beginner , i am trying to learn. E-mail me at: [email protected]
Anyone can help, please give me your MSN. ok. THX alot.