1
Hello, I am a beginner in the C++ language, doing some exercises I came across a message that did not interfere in anything my account, but I would like to know exactly what it means and what I would have to do to make this calculation 100% right for the c++.
#include <iostream>
#include <locale.h>
using namespace std;
int main() {
    setlocale(LC_ALL, "");
    float r, a;
    cout << "Digite o raio de um circulo: ";
        cin >> r;
        a=3.14 * (r * r);//Erro de estouro nessa linha
        cout << "\nA área de um circulo com " << r << " de raio é igual a " << a <<"\n\n";
    return 0;
}
C26451: Arithmetic overflow using the operator '' a value of byte 4 and then converting the result to a value of byte 8. Convert the value to the widest type before calling the operator '' to avoid overflow (io.2).
From now on, thank you.
The constant
3.14is considered to be of the typedoubleand you declaredfloat r, a;. To work only asfloatutilizea = 3.14f * (r * r);. (an f at the end of the floating point constant indicates that it is of the float type).– anonimo