kolioi

41. EVEN ODD in Map C++

Dec 20th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4.  
  5. int main()
  6. {
  7.     using namespace std;
  8.  
  9.     int n;
  10.     cin >> n;
  11.  
  12.     string text[] { "EVEN", "ODD" };
  13.     map<int, string> my_map;
  14.     for (int i = 0; i < n; ++i)
  15.         my_map[i] = text[i%2];
  16.  
  17.     for (auto w : my_map)
  18.         cout << "KEY: " << w.first << " VALUE: " << w.second << endl;
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment