Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include<ctime>
  4.  
  5. using namespace std;
  6.  
  7. int highest(int tab[])
  8. {
  9. int max = 20;
  10. int numer;
  11. for (int n = 0; n < 99; n++)
  12. {
  13. if (tab[n] >= max)
  14. {
  15. max = tab[n];
  16. numer = n;
  17. }
  18. }
  19.  
  20. //cout << "Najwieksza liczba to:" << max << " na pozycycji:" << numer << endl;
  21.  
  22. return numer;
  23.  
  24. }
  25.  
  26. void sortuj(int tab[])
  27. {
  28. for (int n = 0; n < 99; n++)
  29. {
  30. for (int i = 1; i < 99 - n; i++)
  31. {
  32. if(tab[])
  33. }
  34. }
  35. }
  36. int main()
  37. {
  38. srand(time(NULL));
  39.  
  40. int array[100];
  41.  
  42. for (int n = 0; n < 99 ;n++)
  43. {
  44. array[n] = rand() % 181 + 20;
  45. }
  46. for (int n = 0; n < 99; n++)
  47. {
  48. cout << array[n] << " ";
  49. }
  50.  
  51. int x= highest(array);
  52.  
  53. cout << endl<<"x="<<x;
  54.  
  55. int *ptr = &array[x];
  56. cout << endl << "Adres przechowywany przez wskaznik: " << ptr << endl;
  57. cout << "Adres zmioennje x: " << &x;
  58.  
  59. sortuj(array);
  60. system("pause");
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement