摘要: #pragma once #include<iostream> using std::cout; using std::endl; template<typename T> class Vector { public: Vector(T n) :size(n) { p = new T[n]; } V 阅读全文
posted @ 2022-12-05 10:32 lzy1 阅读(20) 评论(0) 推荐(1) 编辑
摘要: #pragma once #include<iostream> #include<string> using namespace std; class MachinePets { public: MachinePets(const string s):nickname(s){} string get 阅读全文
posted @ 2022-11-28 18:43 lzy1 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #pragma once #include<iostream> using namespace std; class vectorInt { public: vectorInt(int n); vectorInt(int n, int value); vectorInt(const vectorIn 阅读全文
posted @ 2022-11-03 15:36 lzy1 阅读(20) 评论(0) 推荐(0) 编辑
摘要: #pragma once #include<iostream> #include<string> #include <iomanip> using namespace std; class Info { public: Info() {} Info(string _nickname, string 阅读全文
posted @ 2022-10-23 14:42 lzy1 阅读(12) 评论(0) 推荐(0) 编辑
摘要: #pragma once #include<iostream> #include <cmath> using std::cout; using std::endl; class Complex { public: Complex(double r = 0, double i = 0):real(r) 阅读全文
posted @ 2022-10-15 21:23 lzy1 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include <string> #include <vector> int main() { using namespace std; string s1; string s2{"c plus plus"}; string s3{s2}; string s4 阅读全文
posted @ 2022-09-30 15:53 lzy1 阅读(22) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #define N 5 // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int score; } STU; // 函数声明 void inp 阅读全文
posted @ 2021-12-27 16:43 lzy1 阅读(12) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> #define N 5 int binarySearch(int *x, int n, int item); // 函数声明 int main() { int a[N] = {2, 7, 19, 45, 66}; int i, index, key; print 阅读全文
posted @ 2021-12-19 15:05 lzy1 阅读(41) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> #define N 5 void output(int x[], int n); int main() { int x[N] = {9, 55, 30, 27, 22}; int i; int k; // 用于记录最大元素的下标 int t; // 用作交换两个 阅读全文
posted @ 2021-12-13 16:32 lzy1 阅读(49) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> const int N=4; int main() { int a[N]={2,0,2,1}; char b[N]={'2','0','1','1'}; int i; printf("sizeof(int) = %d\n", sizeof(int)); prin 阅读全文
posted @ 2021-12-01 21:07 lzy1 阅读(44) 评论(2) 推荐(0) 编辑