Advertisement
cska1312

01. Count Real Numbers

May 11th, 2023
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <utility>
  4. #include<map>
  5. #include <sstream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     string str;
  11.     getline(cin, str);
  12.     istringstream istr(str);
  13.  
  14.     map<double, size_t> doubles;
  15.     double d;
  16.     while (istr >> d)
  17.     {
  18.         doubles[d]++;
  19.     }
  20.         for (pair<double, size_t> cur : doubles)
  21.             cout << cur.first << " -> " << cur.second << endl;
  22.  
  23.             return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement