Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. const int l = 5;
  8.  
  9. int* arr = new int[1];
  10.  
  11. int *min = new int;
  12.  
  13. for (int i = 0; i < l; i++)
  14.  
  15. {
  16. cin >> arr[i];
  17.  
  18. if (i == 0)
  19.  
  20. {
  21. *min = arr[i];
  22. }
  23.  
  24. if (arr[i] < *min)
  25.  
  26. {
  27. *min = arr[i];
  28.  
  29. }
  30.  
  31. }
  32.  
  33. cout << "Min element:" << *min;
  34. delete[] arr;
  35. delete min;
  36. return 0;
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement