Untitled
#include <iostream> #include <fstream> using namespace std; void y(int x, int b, int c, ofstream &file, int n) { int y = 0; while (x < n) { y = x * x + 5 * x - 4; file << " | x = " << x << " ; y = " << y << " \n "; x += c; cout << " | x = " << x << " ; y = " << y << " \n "; } } int main(){ int b, c; cin >> b >> c; int x = b; int n; cin >> n; ofstream file("y(x).txt"); y(x, b, c, file, n); }
Leave a Comment