wheelsmanx

CPS 272 Machine Problem Binary Search Start

Jan 7th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <time.h>
  4. #include <vector>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. vector<int> intArray;
  10. //mySort fucntion for the sortVector function.
  11. bool mySort(int i, int j) {
  12. return (i < j);
  13. }
  14. //fill the vector with 100 random integers.
  15. vector<int> fillVector(vector<int> userInput) {
  16. vector<int> returnObject;
  17. for (int i = 0; i < 100; i++) {
  18. returnObject.push_back(rand() % 100);
  19. }
  20. return returnObject;
  21. }
  22.  
  23. //sort the vector
  24. vector<int> sortVector(vector<int> userInput) {
  25. vector<int> returnObject;
  26. sort(userInput.begin(), userInput.end(), mySort);
  27. returnObject = userInput;
  28. return returnObject;
  29. }
  30.  
  31. bool findRandomNumer(vector<int> userInput) {
  32. bool returnObject = false;
  33. int numberToFind = userInput[rand() % userInput.size()];
  34. int currentIndex, nextIndex;
  35. if (userInput.size() > 1) {
  36. nextIndex = userInput.size() / 2;
  37.  
  38. }
  39. }
  40.  
  41. void main() {
  42.  
  43.  
  44. system("pause");
  45. }
Advertisement
Add Comment
Please, Sign In to add comment