+ 2
Which data type we used in c++ language? if we want to store largest number like e.g12345678910
10 Antworten
+ 4
What are you doing that you need such a big number though?
+ 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;
}
+ 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.
+ 2
Coding Santa thanks done
+ 1
Ipang yes
+ 1
Coding Santa how can we cin>> any phone in string write an example?
+ 1
You can use double or long double instead of int you can store up to 15 digit i think
0
If you want to just store that number, use string
0
Michal Doruch give an example
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/