摘要: 1 #include <iostream> 2 #include "Vector.hpp" 3 using namespace std; 4 5 template<typename T> 6 void output(const Vector<T>& v){ 7 for(auto i=0;i<v.ge 阅读全文
posted @ 2023-12-17 17:58 张帅yyds 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 3 using std::cout; 4 using std::endl; 5 6 class A{ 7 public: 8 A(int x0, int y0): x{ x0 }, y{ y0 } {} 9 void show() const { co 阅读全文
posted @ 2023-12-01 09:46 张帅yyds 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1 #pragma once 2 #include <iostream> 3 4 using std::cout; 5 6 using std::endl; 7 8 class Point { 9 10 public: 11 Point(int x0 = 0, int y0 = 0); 12 ~Po 阅读全文
posted @ 2023-11-06 09:55 张帅yyds 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include<cmath> 3 4 class Complex { 5 private: 6 double real, imag; 7 public: 8 Complex(double r = 0, double i = 0) : real{r}, 阅读全文
posted @ 2023-10-23 09:45 张帅yyds 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <vector> #include <array> template <typename T> void output1(const T &obj) { for (auto i : obj) std::co 阅读全文
posted @ 2023-10-23 00:50 张帅yyds 阅读(6) 评论(0) 推荐(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-21 15:50 张帅yyds 阅读(34) 评论(1) 推荐(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; printf("original array:\ 阅读全文
posted @ 2021-12-10 21:19 张帅yyds 阅读(31) 评论(1) 推荐(0) 编辑
摘要: #include <stdio.h> const int N = 4; int main() { int a[N] = {2, 0, 2, 1}; // 定义一个int型数组a,包含N个元素 char b[N] = {'2', '0', '1', '1'}; // 定义一个char型数组a,包含N个 阅读全文
posted @ 2021-12-08 12:53 张帅yyds 阅读(27) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> long long fac(int n); int main() { int i, n; printf("Enter n: "); scanf_s("%d", &n); for (i = 1; i <= n; ++i) printf("%d! = %lld\n" 阅读全文
posted @ 2021-11-30 21:03 张帅yyds 阅读(42) 评论(1) 推荐(0) 编辑
摘要: #include <stdio.h> int main() { int num; scanf_s("%d", &num); printf("2049%04d\n", num); scanf_s("%d", &num); printf("2049%04d\n", num); scanf_s("%d", 阅读全文
posted @ 2021-11-15 20:46 张帅yyds 阅读(7) 评论(3) 推荐(0) 编辑