I am trying to divide a digit in a string which is selected by its index by 10. But instead of giving me 0.x, it provides me a different answer.
Here is an example to reproduce the error:
#include <iostream>
using namespace std;
int main()
{
string y = "2";
double x = y[0];
cout << x/10.0 << endl;
}