I have a large number in c++ stored as a precise double value (assuming the input ‘n’ is 75): 2.4891e+109
Is there any way to convert this to a string or an array of each individual digit?
Here’s my code so far, although it’s not entirely relevant to the question:
int main(){
double n = 0;
cout << "Giz a number: ";
cin >> n;
double val = 1;
for(double i = 1; i <= n; i++){
val = val * i;
}
//Convert val to string/array here?
}
You may also be interested in the
scientificformat flag.C++11 also has a few interesting functions
std::to_stringwhich you may want to check out!