Untitled
unknown
plain_text
3 years ago
481 B
11
Indexable
#include <iostream> #include <math.h> using namespace std; int main() { float h = 0.1; float a = 0.75; float b = 1.19; float c = -2.5; for (float x = 0; x < 1; x += h) { float y = 0; if (x < 0.5) { y = a * x + b * cos(x); } else if (x >= 0.5 && x <= 1) { y = b * pow(x, 2) + c * sin(2 * x); } cout << "\nx = " << x << " y = " << y; } }
Editor is loading...