Untitled
unknown
c_cpp
2 years ago
367 B
7
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