#include #include #include void pause (void) { cout << "Hit any key to continue..."; getch (); } void main (void) { double pipe_diameter /* internal */, shortest_diagonal, width, height, length; cout << "Enter internal diameter of the pipe: "; cin >> pipe_diameter; cout << "Enter width, height, and length of the object: "; cin >> width >> height >> length; if ((pipe_diameter <= 0) || (width <= 0) || (height <= 0) || (length <= 0)) { cout << "The dimensions entered are unreasonable." << endl; } else { if ((width > height) && (width > length)) { // width is the biggest dimension - use height and length shortest_diagonal = sqrt((height * height) + (length * length)); // if width is not the biggest dimension, either height or length must be } else if (height > length) { // height is the biggest dimension - use width and length shortest_diagonal = sqrt((width * width) + (length * length)); } else { // length must be the biggest dimension - use height and width shortest_diagonal = sqrt((height * height) + (width * width)); } if (shortest_diagonal <= pipe_diameter) { cout << "The object will fit through the pipe." << endl; } else { cout << "The object will not fit through the pipe." << endl; } } pause (); }