You’re neither incrementing i
nor decrementing t
, meaning that your loop is very likely to be an infinite one:
while(i<t)
{
x[i] = a * sin(2 * 3.14 * f * t);
cout<<x[i]<<" ";
}
Presumably there should be something like an i++
inside that loop body, depending on your needs.
You’ll probably also find that every array element is being set to the same value because you’re using t
in the calculation rather than some function of i
.