Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
532 B
0
Indexable
Never
#include <iostream>
#include <fstream>
using namespace std;

void func(int n, int a, int d, ofstream &fout) {
	
	int y;
	for (int i = a; i < a + n; i += d) {
		y = (i * i) + (5 * i) - 4;
		fout << "x = " << i << ", y = " << y << endl;
	}
}

int main() {
	setlocale(LC_ALL, "Russian");
	ofstream fout("func.txt");
	int n, a, d;
	cout << "Количество точек: ";
	cin >> n;
	cout << "Начальная точка: ";
	cin >> a;
	cout << "Смещение по: ";
	cin >> d;
	func(n, a, d,fout);
}
Leave a Comment