mercredi 3 juillet 2019

Is there a way to save a variable in an std::string?

Is there a way to save a variable in an std::string and use it later? In this code I expect the output to be 41

#include <iostream>

int main(){
  std::string number [5] = {1,2,3,4,5};

  std::string join = "number[3]+number[0]";

  std::cout << join; // Expect result should 41.

  return 0;
}





Aucun commentaire:

Enregistrer un commentaire