Help with for loop question.

Write a C++ program that uses a fixed-count loop of four. For each pass through the loop, enter the fluid's viscosity and density from the following chart. Your program should then determine the kinematic viscosity for each fluid, using the following formula.

kinematic viscosity = viscosity/density


gasoline | viscosity = .4466 * 10^-3 | Density = .7186 * 10^3

medium fuel oil | viscosity = 2.9922 * 10^-3 | Density = .8496 * 10^3

medium lubricating oil | viscosity = 87.0736 * 10^-3 | Density = .8865 * 10^3

water | viscosity = .8975 * 10^-3 | Density = .9973 * 10^3


Can anyone help me with this? I am completely lost with this as I keep getting errors and infinite loops.
Last edited on
I would have a look at: http://www.cplusplus.com/doc/tutorial/control/

Afterward I would slowly reread what you need to do.

Hint: There is four different fluids and one formula. 2nd what is the question you need to solve.
I need to find kinematic viscosity for all 4 fluids.
Can you post your code for what you got done so far?
Honestly I just need help with getting started as I'm lost on how to set it up.
Ok lets start off with this.

1
2
3
4
5
6
7
8
#include <iostream> // for cin and cout
#include <cmath> // for pow if needed
using namespace std;

int main() {

    return 0;
}


It looks like you are making a program which takes in input from the user for viscosity and density. So what would you need to write to get input for these two?
Topic archived. No new replies allowed.