Today, my classmates asked me if there is any simple way to find out the sum of two numbers in C + +, then there is a way to title.
The return value of LOG10 (100) is the return value of 2,log (999) is more, but if you position the return value int, it will automatically convert to 2.
#include<iostream>#include<cmath>usingnamespacestd;int main(){ int a,b; while(cin>>a>>b){ a=log10(a+b)+1; cout<<a<<endl; } return0;}
For the first time, there are log2 () and other functions, with log10l () and log10f () can also meet different precision.
This does not have to use many for loops to solve, although this article after all simple (after all, water, escape ...) ), but hope to help the novice programming friends.
Extras
Ask for votes or forward support ... I hope I don't die too badly ...
Please click here: Vote
Voting starts from number 10th and continues to number 20th, please!
—————— Of course you can also click on the image directly
Daily notes: Log10 functions in C + +