摘要: 任务四、 vector.hpp #pragma once #include <iostream> using namespace std; template<typename T> class Vector { public: Vector(int n) :size{ n } { p = new T 阅读全文
posted @ 2022-12-01 21:14 淮左谪仙 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 任务四、 pets.hpp #pragma once #include<iostream> #include<typeinfo> #include<string> using namespace std; class Machinepets { public: virtual string talk 阅读全文
posted @ 2022-11-27 15:23 淮左谪仙 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 任务五: vectorInt.hpp #pragma once #include <cassert> #include <iostream> using namespace std; class vectorInt { public: vectorInt(int n); ~vectorInt() { 阅读全文
posted @ 2022-11-06 16:03 淮左谪仙 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 任务五 info.hpp #include <iostream> #include <string> using namespace std; class info { private: string nickname, contact, city; int n; public: info(stri 阅读全文
posted @ 2022-10-23 14:54 淮左谪仙 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 任务四 Complex.hpp #pragma once #include <iostream> #include <cmath> using std::cout; using std::endl; class Complex { public: Complex(double x0, double 阅读全文
posted @ 2022-10-16 15:03 淮左谪仙 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include<string> #include<vector> int main() { using namespace std; string s1; string s2{ "c plus plus" }; string s3{ s2 }; string 阅读全文
posted @ 2022-09-30 00:01 淮左谪仙 阅读(12) 评论(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-23 23:39 淮左谪仙 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 1. #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; pr 阅读全文
posted @ 2021-12-16 17:44 淮左谪仙 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 1.(1)交换1次 (2)交换3次 第一种是直接找到最大值,与最后一项交换。第二种是把相邻两项较大值放在右边,并多次比较,从而实现最大值出现在最后。 2. #include <stdio.h> #define N 5 int binarySearch(int x[], int n, int item 阅读全文
posted @ 2021-12-13 18:05 淮左谪仙 阅读(24) 评论(0) 推荐(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)); printf(" 阅读全文
posted @ 2021-12-04 17:46 淮左谪仙 阅读(30) 评论(0) 推荐(0) 编辑