fork(1) download
  1. #include <map>
  2. #include <iostream>
  3.  
  4. static std::map<int, const char*> staticMap;
  5.  
  6. const char* a = staticMap[0] = "a";
  7. const char* b = staticMap[1] = "b";
  8. const char* c = staticMap[2] = "c";
  9. const char* d = staticMap[3] = "d";
  10. const char* e = staticMap[4] = "e";
  11.  
  12. int main() {
  13. std::cout << "# Items: " << staticMap.size() << '\n' << std::endl;
  14.  
  15. std::cout << "Values:\n";
  16. std::cout << "\"a\" = " << a << '\n';
  17. std::cout << "\"b\" = " << b << '\n';
  18. std::cout << "\"c\" = " << c << '\n';
  19. std::cout << "\"d\" = " << d << '\n';
  20. std::cout << "\"e\" = " << e << '\n';
  21.  
  22. std::cout << std::endl;
  23.  
  24. std::cout << "Map Contents:" << std::endl;;
  25. for (unsigned i = 0; i < 5; ++i) {
  26. std::cout << "\t" << staticMap[i] << std::endl;
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
# Items: 5

Values:
"a" = a
"b" = b
"c" = c
"d" = d
"e" = e

Map Contents:
	a
	b
	c
	d
	e