fork(3) download
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4. #include <algorithm>
  5. #include <cstring>
  6. using namespace std;
  7.  
  8. int main() {
  9. map<string,string> mymap_fast_alert{{"a","A"},{"b","B"},{"c","C"}};
  10. char **choices = new char*[mymap_fast_alert.size()];
  11. size_t k=0;
  12. for(auto it1 : mymap_fast_alert) {
  13. string tmp = it1.second + " |" + it1.first;
  14. choices[k] = new char [tmp.size()+1];
  15. strcpy (choices[k], tmp.c_str());
  16. k++;
  17. }
  18.  
  19. for_each (choices, choices+k, [](auto s){
  20. cout << s << endl;
  21. });
  22. }
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
A |a
B |b
C |c