Run time error related

hey i was trying to program the calculator we aren’t taught function in the lessons before then how in the editorial functions are being used its quite confusing and is it necessary that we perform the the calculation in a third variable then print it after ward cant we just print the result directly
cout<<n1+n2<<endl; like this
do we have to doo rev = n1+n2;
then print rev in the end;