You are setting all of your valuables to 0 at the beginning. Try:
int radius:
at the beginning, this will create your variable but not give it a value, then after cin >> radius; you can do basically what you had before:
cin >> radius;
auto area = radius*radius * 3.14;
auto amount = area * price;
Or you could just get rid of the area variable and just do:
cin >> radius;
auto amount = radius*radius * 3.14 * price;
Note also that the area of a circle is pi*r*r, not pi*r. Moreover, you shouldn’t to the computation using ints. In above code auto will automatically be a floating-point number (double in this case, since 3.14 is a double literal).
0
solved Cpp program not working as expected [closed]