### Need help with decimals.

Hi guys, I'm trying to write a program that takes the Voltage, and Current as input, and then generates the Resistance. According to my task both inputs HAS to be integers, the output has to display 3 decimal places, but for some reason the decimals displays ".000" no matter what I do, I want it to display "4.234" instead of "4.000" for example.

Here is my code:

 ``123456789101112131415`` ``````int Voltage; int Current; double Resistance; cout << "Enter the Voltage: "; cin >> Voltage; cout << "Enter the Current: "; cin >> Current; Resistance = (Voltage/Current); cout << "The resistance is " << fixed << setprecision(3) << Resistance << " ohm" << endl; return 0;``````

If the answer should be for example 7.324, it displays the answer as 7.000, how can I fix this?

Voltage and Current should be of type `double`. Integer division is always an integer, you can't retroactively cast it.
 ``12345678910111213141516171819202122`` ``````#include #include using namespace std; int main() { double Voltage; double Current; double Resistance; cout << "Enter the Voltage: "; cin >> Voltage; cout << "Enter the Current: "; cin >> Current; Resistance = (Voltage/Current); cout << "The resistance is " << fixed << setprecision(3) << Resistance << " ohm" << endl; return 0; }``````