Professional Documents
Culture Documents
enter the number of rows first. The number of rows must be at least 3 and at mos
t 35. ";
cin >> rows;
while (rows < 3 || rows > 35)
{
cout << "The number of rows in our array must be at least 3 and
at most 35. Please enter a valid number for the rows in our array. ";
cin >> rows;
}
cout << "Please enter the number of columns you would like our array to
have. The number of columns must be at least 3 and at most 20. ";
cin >> cols;
while (cols < 3 || cols > 20)
{
cout << "The number of columns in our array must be at least 3 a
nd at most 30. Please enter a valid number for the columns in our array. ";
cin >> cols;
}
//Prompt the user to enter the values of the top, bottom, left, and righ
t edges of the 2-D array and check that the values entered are valid
cout << "What temperature would you like the top edge of the thin metal
plate to be ? The temperature must be at least 0 and at most 300. ";
cin >> topEdge;
while (topEdge < 0 || topEdge > 300)
{
cout << "The temperature of the top edge must be at least 0 and
at most 300. Please enter a valid number for the temperature of the top edge. ";
cin >> topEdge;
}
cout << "What temperature would you like the bottom edge of the thin met
al plate to be ? The temperature must be at least 0 and at most 300. ";
cin >> bottomEdge;
while (bottomEdge < 0 || bottomEdge > 300)
{
cout << "The temperature of the bottom edge must be at least 0 a
nd at most 300. Please enter a valid number for the temperature of the bottom ed
ge. ";
cin >> bottomEdge;
}
cout << "What temperature would you like the left edge of the thin metal
plate to be ? The temperature must be at least 0 and at most 300. ";
cin >> leftEdge;
while (leftEdge < 0 || leftEdge > 300)
{
cout << "The temperature of the left edge must be at least 0 and
at most 300. Please enter a valid number for the temperature of the left edge.
";
cin >> leftEdge;
}
cout << "What temperature would you like the right edge of the thin meta
l plate to be ? The temperature must be at least 0 and at most 300. ";
cin >> rightEdge;
while (rightEdge < 0 || rightEdge > 300)
{
cout << "The temperature of the right edge must be at least 0 an
d at most 300. Please enter a valid number for the temperature of the right edge
. ";
cin >> rightEdge;
}