Advertisement
kxcoze

lab6_8_2

Mar 17th, 2020
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.70 KB | None | 0 0
  1. #include <iostream>                                                    
  2.                                                                              
  3. using namespace std;                                                    
  4.      
  5. double vec(double minElement, int num, int cnt) {                                            
  6.     if (num >= cnt-1)                                    
  7.         return minElement;                                                                  
  8.                                                                              
  9.     double newElement;                                                        
  10.     cin >> newElement;                                                  
  11.     minElement = min(newElement, minElement);                              
  12.                                                                                              
  13.     return vec(minElement, ++num, cnt);                                                      
  14. }                                                        
  15.                                                                                          
  16. int main() {                                                                          
  17.     int n;                                            
  18.     cin >> n;                                                  
  19.                                                                  
  20.     double t;                                                          
  21.     cin >> t;                                        
  22.                                                                  
  23.     cout << vec(t, 0, n) << '\n';                                
  24.     return 0;                                        
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement