nesting loops?

so I'm trying to create a code that follows these guidelines

// create code so that 4 rectangular prisms are created.
// the formula for the length of the first prism = 3(x+4)/5 + 2
// the formula for the width of the first prism = 4 + 5 * x * x
// the formula for the height of the first prism = 3x / 2
// Ask the user for an integer input for x
// For the subsequent 3 prisms, increase x by 1.
// output all appropriate information.

and i get stuck at the part where I have to increase x by 1..

do i insert a nested loop so that after the second time the program asks the user for length/width/height it will automatically add one to their number?
and then when i ask for the dimensions again the 3rd time, x will increase +2?



int number = 0;
while (number < 4)
{


double lengthX, widthY, heightZ;
double x, y , z; // x= length, y= width, z = height
double prismVolume; // length * width * height

cout << "Enter length: " << endl;
cin >> x ;

lengthX = (x+4)/5 + 2;

cout << "length of x is " << lengthX << endl;

cout << "Enter width: " << endl;
cin >> y;

widthY = 4 + 5 * y * y;
cout << "The width is " << widthY << endl;

cout << "Enter the height: " << endl;
cin >> z;

heightZ = (3 * z ) / 2; cout << "The width is " << heightZ << endl;

prismVolume = lengthX * widthY * heightZ;

cout << "This rectangular prism has a volume of " << prismVolume << endl;

number++;

}


so this right here just repeats 4 times.. but i have yet to incorporate the part where x increases by 1

[/code]
Please edit your code and use code tags otherwise its unreadable - http://www.cplusplus.com/articles/jEywvCM9/
Topic archived. No new replies allowed.