For homework we've been assigned I am trying to use a for loop in c++ but apparently I don't understand how they work that well. Here's the code:
{
double L,W,E,A,H,B,I;
L=6.5;
W=2;
E=450;
A=2.8;
H=0.5;
B=0.8;
I= (1/12)*B*(H*H*H);
for ( double x = 0; 0 <= x <= 2.8; x + 0.1)
{
double F,S,G;
F= -((W)*(x*x))/(24*E*I);
S= (6*(A*A))-(4*A*x)+(x*x);
G= F*S;
cout << G;
}
Basically what I'm trying to do is make a loop where x increases in increments of 0.1 until it hits 2.8, outputting the values for G along the way. But right now it gives me an infinite output of nan. Is there something I'm missing?