I made a calculating program, in which I used several variables to store specific numbers as the codes shown below. But when the program executes to the point "cout<<G<<endl;", the result came out as "0". The same goes for all the following ""cout<<...<<endl;". How do I make the program show the true number stored in those variables?
#include<iostream>
using namespace std;
int main(){
It does print the "true" number, however the calculation overflows.
A 32 bit signed integer can only hold numbers up to 2^31-1 ~ 2.1 billion. Use a larger type (uint64_t) or double (at the cost of accuracy).