How to perform mathematical operations on number represented as string in c++? How do I store number larger than c++ numerical?

C++ question

10th May 2021, 12:37 AM
BlackChar - avatar
2 Answers
+ 1
In order to deal with huge numbers, you can either use a custom user defined datatype ( string , arrays etc ) to store them and then create functions to perform calculation on them manually or use an external library like gnu's multiple precision arithmetic library to do that for you. Here's a simple implementation of bignum calculator used to calculate value of large Fibonacci numbers that I created for one of the community challange here on SL 👇
10th May 2021, 3:39 AM
Arsenic - avatar
#include<stdio.h> int main() { const char *str = "12345"; int x; sscanf(str, "%d", &x); printf("\nThe value of x : %d", x); return 0; }
10th May 2021, 12:57 AM
Alfonso Farías
Alfonso Farías - avatar