+ 2

Which data type we used in c++ language? if we want to store largest number like e.g12345678910

25th Dec 2021, 11:26 AM
Ali Ibtisam
Ali Ibtisam - avatar
10 ответов
+ 4
What are you doing that you need such a big number though?
25th Dec 2021, 12:19 PM
Ipang
+ 3
cin >> any phone in string: #include <iostream> #include <string> using namespace std; int main() { string phoneNumber; cout << "Type in your phone number" << endl; getline(cin, phoneNumber); cout << "Your phone number is: " << phoneNumber << endl; return 0; }
25th Dec 2021, 3:27 PM
Coding Cat
Coding Cat - avatar
+ 2
unsigned long long from 0 up to 18,446,744,073,709,551,615 But what are you doing with such big numbers? Phone numbers for example can be stored as a string. And distances between stars in AU or light years.
25th Dec 2021, 12:43 PM
Coding Cat
Coding Cat - avatar
+ 2
Coding Santa thanks done
25th Dec 2021, 5:34 PM
Ali Ibtisam
Ali Ibtisam - avatar
+ 1
Ipang yes
25th Dec 2021, 1:54 PM
Ali Ibtisam
Ali Ibtisam - avatar
+ 1
Coding Santa how can we cin>> any phone in string write an example?
25th Dec 2021, 1:59 PM
Ali Ibtisam
Ali Ibtisam - avatar
+ 1
You can use double or long double instead of int you can store up to 15 digit i think
27th Dec 2021, 11:13 AM
iosamh123456
0
If you want to just store that number, use string
25th Dec 2021, 1:35 PM
Michal Doruch
0
Michal Doruch give an example
25th Dec 2021, 1:57 PM
Ali Ibtisam
Ali Ibtisam - avatar
0
This is very small number which can be stored by using uint64_t. But if in future you need to store very large number which is not supported by C/C++ you can use arbitrary precision. Python also use that technique to store long numbers. You can take a look at GMP library. Limit of that number will depend upon your RAM https://stackoverflow.com/questions/1218149/arbitrary-precision-arithmetic-explanation https://en.m.wikipedia.org/wiki/Arbitrary-precision_arithmetic https://gmplib.org/
27th Dec 2021, 10:23 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar