Answer the question
In order to leave comments, you need to log in
Programming a branching computing process?
There is pract. task:
PROGRAMMING OF A LINEAR COMPUTING PROCESS something like the beginning will turn out, but in the branching I can’t understand the principle of if and else, and also I don’t know how to put the subscript of the function. In general, picrl:
I know for someone who understands C ++ it will look funny, but still ..
#include<stdio.h>
#include<math.h>
int main()
{
double y,x,f(x),f[1](z),f[2](z),f[3](z),z,c;
y=f(x);
f(x)=pow(x,4)+2*sin*pow(x,2);
c=3.2;
z=cos(c);
x=(f1(z)*f2(z)*f3(z));
if (z<0)
{
f[1](z)=sin*z+tg*z;
printf("\nx=%f,y=%f,x,y")
}
else
if (0<z<8)
{
f[2](z)=pow(cos,3)*z+3/z;
printf("\nx=%f,y=%f,x,y");
}
else
if (z>8)
{
f[3](z)=pow(z,2)+log*pow(z,2);
printf("\nx=%f,y=%f,x,y");
}
else
printf("\n Действительные корни отсутствуют.");
getchar();
}
Answer the question
In order to leave comments, you need to log in
So the task is not to write a C / C ++ program, but to draw a flowchart.
And if you want to write in C, it's better to learn the language first.
And, by the way, there is an error in the problem, for z = 0 the function f2(z) goes to infinity.
#include <stdio.h>
#include <math.h>
double f(x) {
double x2 = x * x;
return x2 * x2 + 2 * sin(x2);
}
double f1(z) {
return sin(z) + tg(z);
}
double f2(z) {
double cz = cos(z);
return cz * cz * cz + 3/z;
}
double f3(z) {
double z2 = z * z;
return z2 + log(z);
}
int main() {
double c = 3.2;
double z = cos(c);
double x;
if (z < 0) {
x = f1(z);
} else if (z < 8) {
x = f2(z);
} else {
x = f3(z);
}
double result = f(x);
printf('%f\n', result);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question