Calculate the value of the function y = x + 4x-2 for all h from -2 to 2 with a step of 0.7

C ++ program

#include <iostream>

using namespace std;
int fun (float x) // I’ll add the function separately, but you can insert it into the for loop, the result will not change. The function takes on the value of the variable x.
{
float y = x + (4 * x) – 2;
return y; // And returns the result – y.
}

int main ()
{
setlocale (LC_ALL, “Russian”); // Russian language of the console.
float x;
for (x = -2; x <= 2; x = x + 0.7) {// loop with a step of 0.7.
cout << “When x =” << x << “y =” << fun (x) << “.” << endl; // At each step, I display the value of the function and transfer it to a new line.
}

}



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.