As you can probably tell, programming is not my thing, but unfortunately this class is required. I seem to have myself an infinite while loop, but I can't figure out why it won't stop looping. I know I still need to fix the formatting for the cout stuff at the bottom, but I'm more concerned about fixing the loop first.it's supposed to calculate deflection of a cantilevered beam. I tested it using values given to me in the example problem included in my homework
length = 5
height = 6
width = 2
fraction = 240
Divide length by fraction gives you (5/240) = 0.0208333
d is supposed to increase with each loop until it is larger than (5/240), then it's supposed to stop. However, for some reason, it isn't stopping.
#include <iostream>
using namespace std;
int main()
{
double length;
double height;
double width;
int weight(0);
const double E = 2.16e8;
cout.setf(ios::fixed);
cout.precision(4);
int fraction;
cout << "Enter length in feet: ";
cin >> length;
cout << "Enter height in inches: ";
cin >> height;
I'm gonna attempt to help you. The "reason" that you have an infinite while loop is because d is never becoming greater than (length/fraction). Can you tell me in words how long you need your while to execute?