So I am very new to programming. I'm trying to create a program for a class assignment that calculates the Reynolds number of liquid flowing through a pipe. The assignment requires me to use "if" statements to determine the actual viscosity of the liquid based on the temperature that the user enters when prompted. However, only the last "if" statement calculates a correct value. All of the "if" statements have the same structure, but only the last one works. Please help.
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double Rnumber, Velocity, viscosity, diameter, temp;
cout << "Enter the temperature of the liquid (degrees Celsuis): " << endl;
cin >> temp;
if (temp == 5.0)
{
viscosity = (1.49 * pow(10, -6));
}
if (temp == 10.0)
{
viscosity = (1.31 * pow(10, -6));
}
if (temp == 15.0)
{
viscosity = (1.15 * pow(10, -6));
}
cout << "Enter the velocity of the liquid (m/s): " << endl;
cin >> Velocity;
cout << "Enter the diameter of the pipe (m): " << endl;
cin >> diameter;
Rnumber = ((Velocity * diameter) / (viscosity));
cout << "The Reynolds number for the system is " << Rnumber << " ."<< endl;
cin.ignore(2);
return 0;
}