Skip to content

Instantly share code, notes, and snippets.

@m1irka
Last active October 24, 2024 10:33
Show Gist options
  • Select an option

  • Save m1irka/3f3130fd39efd71984fac1e338a12016 to your computer and use it in GitHub Desktop.

Select an option

Save m1irka/3f3130fd39efd71984fac1e338a12016 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double y;
for (double i = -2; i <= 3; i += 0.2)
{
if (i>1.5)
{
y = 2.5 * pow(i, 3) + 6 * (i, 2) - 30;
}
if (0 <= i <= 1.5)
{
y = i + 1;
}
if (i < 0)
{
y = i;
cout << "y = " << y << endl;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment