So basically, I have something like this –
Input file with 2 integers.
Code, something like this –
#include <iostream>
#include <fstream>
using namespace std;
int main() {
unsigned long long n, k;
ifstream input_file("file.txt");
input_file >> n >> k;
if(n >= 10^9 || k >= 10^9) {
cout << "0" << endl;
}
return 0;
}
So, is there any chance to check if any of theese two integers are bigger than 10^9? Basically, if I assign thoose integers to unsigned long long, and if they are bigger than 10^9, they automatically turn to some random value, that fits inside unsigned long long, am I right, and that means that there is no chance to check it, or am I’m missing something?
On most platforms, an
unsigned long longwill be able to store 109 with no problem. You just need to say:if (n >= 1000000000ull)If an
unsigned long longis 64-bits, for example, which is common, you can store up to 264