Untitled
unknown
c_cpp
2 years ago
799 B
9
Indexable
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
const string inputName = "input.txt";
const string outputName = "output.txt";
const int d = 10;
void read(vector<int>& num){
ifstream in(inputName.c_str());
if (!in.is_open()) {
cout << "Some get wrong" << "\n";
}
int n{}, a{};
in >> n;
for (int i = 0; i < n; i++) {
in >> a;
num.push_back(a);
}
}
void encrypt(vector<int> &num) {
for (int& i : num) {
i += d;
}
}
void write(vector<int> num) {
ofstream out(outputName.c_str());
if (!out.is_open()) {
cout << "Some get wrong" << "\n";
}
for (int i : num) {
out << i << "\n";
}
out.close();
}
int main(){
vector<int> num{};
read(num);
encrypt(num);
write(num);
}Editor is loading...
Leave a Comment