I am a total beginner in cpp and I tried to make a simple code.
But the code isn’t showing an output beyond the second for loop.
It’ll be very helpful if you can point out my mistake.
I have attached the code,
I am able to input the values for first two loops but it doesn’t show output for the cout statement just after.
#include<iostream>
#include<cmath>
//Assuming value of P'' (0)= (50,10,10) and P ' (1)= (45,15,15)
//Given P(0)= (10,10,10) and P(1)= (200,20,30)
using namespace std;
//Assuming a cubic bezier curve
int main()
{
int B[4][3];
int u;
int i;
for (i = 0; i < 3;)
{
cout << "Enter P0" << i;
cin >> B[0][i];
i=i+1;
}
int z;
for (z = 0; z < 3;)
{
cout << "Enter P1" << z;
cin >> B[3][i];
z=z+1;
}
cout << "bloomberg";
int Pd1_1[3] = { 45,15,15 };
int Pd2_0[3] = { 50,10,10 };
for (i = 0; i < 3; i++)
{
B[1][i] = (6 * B[0][i] + 6 * B[3][i] - 2 * Pd1_1[i] - Pd2_0[i]) / 12;
}
for (i = 0; i < 3; i++)
{
B[2][i] = (-6 * B[0][i] + 12 * B[1][i] + Pd2_0[i]) / 6;
}
cout << "bloomberg";
u = 0;
double FB[11][3];
int h;
while (u <= 1)
{
for (h = 0; h < 11; h++)
{
for (i = 0; i < 3;i++)
{
FB[h][i] = ((-1)*pow(u, 3) + 3 * pow(u, 2) - 3*u + 1) * B[0][i] + (3 * pow(u, 3) - 6 * pow(u, 2) + 3 * u) * B[1][i] + (-3 * pow(u, 2) + 3 * pow(u, 2)) * B[2][i] + pow(u, 3) * B[3][i];
}
}
u = u + 0.1;
}
for (h = 0; h < 11; h++)
{
for (i = 0; i < 3; i++)
{
cout << FB[h][i];
}
}
cout << "bloomberg";
return 0;
}
Source: Windows Questions C++