fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4. #include <vector>
  5.  
  6. using std::cout;
  7. using std::endl;
  8.  
  9. static const int numberofvalues = 5;
  10.  
  11. static const char *cmemblock_values[numberofvalues] = {
  12. "11",
  13. "22",
  14. "33",
  15. "44",
  16. "55",
  17. };
  18.  
  19. static const std::vector<std::string>
  20. cmemblock(cmemblock_values,cmemblock_values+numberofvalues);
  21.  
  22. int main()
  23. {
  24. std::string str;
  25.  
  26. for(int i = 0; i < numberofvalues; i++)
  27. {
  28. str = cmemblock[i];
  29. std::stringstream stream;
  30. stream <<str;
  31. int n;
  32. if (!(stream >>n)){
  33.  
  34. }
  35.  
  36. cout << n<<endl;
  37. }
  38. }
  39.  
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
11
22
33
44
55