Add the initial EN translation for C++ code (#1346)

This commit is contained in:
Yudong Jin
2024-05-06 13:31:46 +08:00
committed by GitHub
parent 9e4017b3fb
commit 8e60d12151
111 changed files with 6993 additions and 9 deletions
+36
View File
@@ -0,0 +1,36 @@
/**
* File: vertex.hpp
* Created Time: 2023-03-02
* Author: krahets (krahets@163.com)
*/
#pragma once
#include <vector>
using namespace std;
/* Vertex class */
struct Vertex {
int val;
Vertex(int x) : val(x) {
}
};
/* Input a list of values vals, return a list of vertices vets */
vector<Vertex *> valsToVets(vector<int> vals) {
vector<Vertex *> vets;
for (int val : vals) {
vets.push_back(new Vertex(val));
}
return vets;
}
/* Input a list of vertices vets, return a list of values vals */
vector<int> vetsToVals(vector<Vertex *> vets) {
vector<int> vals;
for (Vertex *vet : vets) {
vals.push_back(vet->val);
}
return vals;
}