Untitled

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

const string filename = "input.txt";

void readMas(int massx[], int massy[],const int size, int& n) {
	ifstream in(filename);
	if (!in.is_open()) {
		cout << "error"; return;
	}
	in >> n;
	
	int a;
	for (int i = 0; i < n*2 && i < size; i++)
	{
		in >> a;
		massx[i] = a;
		in >> a;
		massy[i] = a;
	}
	in.close();
}

int main()
{
	const int size = 1000;
	int n;
	int a;
	int massx[1000];
	int massy[1000];

	readMas(massx, massy, size, n);
	cout << "x:";
	for (int i = 0; i < n; i++)
	{
		cout << massx[i] << " ";

	}
	cout << endl;
	cout << "y:";
	for (int i = 0; i < n; i++)
	{
		cout << massy[i] << " ";

	}
	

}
Leave a Comment