Hey all, I'm new to C++ and struggling to write a program. I am used to writing in VBA and Mathlab but because I need to run a long run simulation have to rewrite my program in C++. What a am trying to do is if I have a list of values say:
position_axle1
position_axle2
position_axle3
position_axle4
position_axle5
position_axle6
position_axle7
position_axle8
and I am genarating arrays like:
truck_data1[22]
truck_data2[22]
truck_data3[22]
The part I am having trouble writing is if I want a loop that will pick the next "position_axle" in each loop how do i write it.Here is my attempt:
for (int i = 1; i = 100; i = i + 1)
{
int p = 1, q = 3;
double position_axle(i), AxleInfluenceLineXAxleWeight(i);
if(position_axle(i) > bridge_length)
AxleInfluenceLineXAxleWeight(i) = 0;
else if (position_axle(i) < 0)
AxleInfluenceLineXAxleWeight(i) = 0;
else if (position_axle(i) < (bridge_length/2))
AxleInfluenceLineXAxleWeight(i) = (position_axle(i)/2) * truck_data(p)[q];
else
AxleInfluenceLineXAxleWeight(i) = ((bridge_length - position_axle(i))/2) * truck_data(p)[q];
q = q + 1;
if(q > 12)
q = 3;
if(i >=10)
p = 2;
else if(i >= 20)
p = 3;
else if(i >= 30)
p = 4;
else if(i >= 40)
p = 5;
else if(i >= 50)
p = 6;
else if(i >= 60)
p = 7;
else if(i >= 70)
p = 8;
else if(i >= 80)
p = 9;
else if(i >= 90)
p = 10;
if (load_effect1 > max_load_effect1)
max_load_effect1_1 = load_effect1;
else
max_load_effect1_1 = max_load_effect1_1;
t = t + 0.02;
}
return (max_load_effect1_1);