#include <numeric>
#include <iostream>
#include <string>
void waitForEnter();
int main()
{
std::string text {"Hy guys i need a simple way to convert a generic word to int!"};
std::cout << "\"" << text << "\" converted into integer is "
<< std::accumulate(std::next(text.begin()), text.end(),
static_cast<int>(text.at(0)),
[](int a, char b) {
return a + static_cast<int>(b);
})
<< '\n';
waitForEnter();
return 0;
}
void waitForEnter()
{
std::cout << "\nPress ENTER to continue...\n";
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}