Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
367 B
0
Indexable
Never
#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;
}
Leave a Comment