daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Oct 11th, 2018 66 in 4 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <ctime>
  5. #include <iterator>
  6.  
  7. using namespace std;
  8.  
  9.  
  10.  
  11. int main() {
  12.     vector <float> a;
  13.     vector <float> ::iterator p;
  14.     srand((unsigned int)time(NULL));
  15.     for (int i = 0; i < 10; i++)
  16.     {
  17.         a.push_back(rand() % 100);
  18.         cout << *(--a.end()) << ' ';
  19.     }
  20.  
  21.     float m = -1;
  22.  
  23.     m = *max_element(a.begin(), a.end());
  24.  
  25.     cout << "\n\n";
  26.     for (p = a.begin(); p != a.end(); p++)
  27.     {
  28.         *p = *p / m;
  29.         cout << *p << " ";
  30.     }
  31.  
  32.     system("pause");
  33.     return 0;
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top