#include<iostream> #include<fstream> #include<iomanip> using namespace std; void test() { ofstream out; out.open("cipher_ke.txt"); if (!out.is_open()) { cout << "fail to open cipher_key.txt to write" << endl; return; } out << " "; cout << " "; for (int i = 0, j = 97; i < 26; i++ ,j++) { char x = j; cout << setw(2) << setfill(' ') << x; out << setw(2) << setfill(' ') << x; } out << endl; cout << endl; //密码表 for (int k = 1; k <= 26; k++) { cout << setw(2) << setfill(' ') << k; out << setw(2) << setfill(' ') << k; static int i = 66; int j, a; j = i; int m; for (a = i; a <= 90; a++) { char x1 = a; cout << setw(2) << setfill(' ') << x1; out << setw(2) << setfill(' ') << x1; } for (m = 65; m < j; m++) { char x2 = m; cout << setw(2) << setfill(' ') << x2; out << setw(2) << setfill(' ') << x2; } i++; cout << endl; out << endl; } } int main() { test(); }
#pragma once #pragma once #include<iostream> #define MAXSIZE 10000 using namespace std; template<typename T> class Vector { public: //构造函数与析构函数 Vector(int n) { data = new T[n]; size = n; } Vector(int n, T value) { data = new int[n]; size = n; for (int i = 0; i < size; i++) { data[i] = value; } } Vector(const Vector<T>& x) { size = x.size; data = new int[size]; for (int i = 0; i < size; i++) { data[i] = x.data[i]; } } ~Vector<T>() { delete[] data; } //成员函数 T& at(int i) { return data[i]; } T& operator[](int i) { return data[i]; } int get_size() { return size; } private: T* data; int size; friend void output(const Vector& x) { for (int i = 0; i < x.size; i++) { cout << x.data[i] << " "; } cout << endl; } };
标签:int,out,Vector,实验,include,data,size From: https://www.cnblogs.com/jat2003725w/p/16938122.html