Untitled

 avatar
unknown
c_cpp
a year ago
367 B
3
Indexable
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;




int main()
{	
	ifstream file("t.txt");
	if (!file.is_open()) {
		cerr << "Error\n";
		return 0;
	}
	vector <int> a;
	int n;

	while (file >> n) {
		a.push_back(n);
	}
	file.close();

	for (int n : a) {
		cout << n << " ";
	}
	return 0;
}
Editor is loading...
Leave a Comment