A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Hello @Sid Kraft ,
Thanks for your question.
Since CHMID1, CHMID2, CHMID3 were declared with no size, no slots exist to store data. Furthermore, CHTMP1, CHTMP2, CHTMP3 were declared inside do{}, they die when loop ends.
You can refer to following code example:
#include <vector>
int main() {
std::vector<float> PT1 = {1.0f, 2.0f, 3.0f};
std::vector<float> PT2 = {1.0f, 2.0f, 3.0f};
std::vector<float> PT3 = {1.0f, 2.0f, 3.0f};
std::vector<float> VEC1 = {1.0f, 2.0f, 3.0f};
std::vector<float> VEC2 = {1.0f, 2.0f, 3.0f};
std::vector<float> VEC3 = {1.0f, 2.0f, 3.0f};
float CHORD1 = 1.0f, CHORD2 = 1.0f, CHORD3 = 1.0f;
std::vector<float> CHMID1(3);
std::vector<float> CHMID2(3);
std::vector<float> CHMID3(3);
float CHTMP1 = 0.0f;
float CHTMP2 = 0.0f;
float CHTMP3 = 0.0f;
int I = 0;
do
{
float CH1 = PT1[I];
float CH2 = PT2[I];
float CH3 = PT3[I];
float VC1 = VEC1[I];
float VC2 = VEC2[I];
float VC3 = VEC3[I];
CHTMP1 = CH1 + (CHORD1 * VC1) / 2.0f;
CHTMP2 = CH2 + (CHORD2 * VC2) / 2.0f;
CHTMP3 = CH3 + (CHORD3 * VC3) / 2.0f;
CHMID1[I] = CHTMP1;
CHMID2[I] = CHTMP2;
CHMID3[I] = CHTMP3;
++I;
} while(I <= 2);
return 0;
}
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.