Исправьте пожалуйста ошибки в с++.
#include
#include
#include
#include
#include
int main()
{
srand(time(NULL));
float x[12];
float y;
float pi=3.14;
for(int i=1; i<=12;i++)
{
x=rand()0+20;
if(fabs(x)<0.1)
{
y=x-(x*x*x)/3;
printf("/f ",y);
}
if (fabs(x)<0.1 && fabs(x)==0.1)
{
y= cos(pi/2-x);
printf("/f ",y);
}
}
getchar();
return 0;
}
x=rand()0+20;
#include
#include
#include
#include
#include
int main()
{
srand(time(NULL));
float x[12];
float y;
float pi=3.14;
for(int i=1; i<=12;i++)
{
x=rand()% 30+20;
if(fabs(x)<0.1)
{
y=x-(x*x*x)/3;
printf("%f ",y);
}
if (fabs(x)<0.1 && fabs(x)==0.1)
{
y= cos(pi/2-x);
printf("%f ",y);
}
}
getchar();
return 0;
}
20 - cannot convert `float*' to `double' for argument `1' to `double fabs(double)'
22 - invalid operands of types `float[12]' and `float[12]' to binary `operator*'
25 - cannot convert `float*' to `double' for argument `1' to `double fabs(double)'
25 - cannot convert `float*' to `double' for argument `1' to `double fabs(double)'
27 - invalid operands of types `float' and `float[12]' to binary `operator-'