2021寒假打卡
NJNUqhx
大一新生,努力学习ing
展开
-
2021年2月7日18:29:12 二叉树基本操作,堕落了几天才敲代码
#include<stdio.h>#include<stdlib.h>struct BinaryTree{ int val; struct BinaryTree* left; struct BinaryTree* right;};struct TreeNode{ struct BinaryTree* node; struct TreeNode* next;};struct Queue{ struct TreeNode* front; struct .原创 2021-02-07 18:30:19 · 63 阅读 · 0 评论 -
2021-01-28
原创 2021-01-28 21:01:39 · 46 阅读 · 0 评论 -
2021-01-27
原创 2021-01-27 21:25:35 · 67 阅读 · 0 评论 -
2021年1月28日15:40:40 基于多态的职工管理系统实验(寒假第一个项目,耗时三个半天)
#include<iostream>#include<fstream>#include<string>using namespace std;#include"workermanager.h"#include"worker.h"#include"employee.h"#include"manager.h"#include"boss.h"#define filename "work .txt"//void test()//{// worker* p.原创 2021-01-28 15:45:11 · 171 阅读 · 0 评论 -
2021年1月27日18:11:41 二进制读写文件
#include<iostream>#include<string>#include<fstream>using namespace std;class person{public: char name[64]; int age;};void test(){ ofstream ofs("person.txt",ios::out|ios::binary); person p = { "black",18 }; ofs.write((const .原创 2021-01-27 18:13:22 · 108 阅读 · 0 评论 -
2021年1月27日16:28:10 文件读写
#include<iostream>#include<fstream>#include<string>using namespace std;void func(){ cout << "-------------------" << endl;}void test1(){ ofstream ofs; ofs.open("test1.txt",ios::out); ofs << "name:black" <.原创 2021-01-27 16:28:32 · 105 阅读 · 0 评论 -
2021-01-26
达成成就:一天看完26节c++网课原创 2021-01-26 20:57:55 · 57 阅读 · 0 评论 -
2021-01-26
达成成就:一上午看完10节c++网课,不愧是我原创 2021-01-26 12:05:54 · 50 阅读 · 0 评论 -
2021-01-25
原创 2021-01-25 21:45:56 · 42 阅读 · 0 评论 -
2021-01-24
原创 2021-01-24 20:24:04 · 104 阅读 · 1 评论 -
2021年1月25日08:53:27
#include<iostream>#include<string>using namespace std;/* 2021年1月25日08:28:31 类 圆类练习,学生类 1.类中的属性和行为 成员 2.属性 成员属性 成员变量 3.行为 成员函数 成员方法 */const double pi = 3.14;class circle{public: int r;//属性 double calculate() { return 2 * r * p.原创 2021-01-25 08:54:10 · 86 阅读 · 0 评论 -
青牛将隐
青牛将隐题目背景有一即有二,有三即有四。一二三四五,有亦何妨事。题目描述输出一个数列,穿插排列,最大数字为n。具体穿插方式为:开始数列中只有一个数字1,然后每次在数字i两边空隙中增加数字i+1。你可以参照样例来理解题意。格式输入格式一行一个整数n。输出格式一行若干个数字表示答案。样例输入样例13Copy输出样例13 2 3 1 3 2 3Copy数据范围50%1 \leq n \leq 81≤n≤8100%1 \le..原创 2021-01-24 14:08:15 · 167 阅读 · 0 评论 -
2021年1月24日13:08:09螺旋矩阵
/* 2021年1月24日12:21:58 输出m*n的螺旋矩阵 */#include<stdio.h>#include<stdlib.h>void creatmatrix(int** r,int n,int m){ int x,y; int cnt=1,time=-1;//length->m,width->n printf("creating...\n"); while(1) { time++; for(x=time,y=time;y&.原创 2021-01-24 13:08:42 · 116 阅读 · 2 评论 -
2021年1月24日12:17:37填数游戏
/* 2021年1月24日12:04:42 填数游戏 */#include<stdio.h>#include<stdlib.h>void print(int i,int j,int k){ int x=100*i+10*j+k; int a[10]={0}; int n[3]={x,2*x,3*x}; int r; int flag=1; for(i=0;i<3;i++) { while(n[i]) { r=n[i]%10; a.原创 2021-01-24 12:18:02 · 84 阅读 · 0 评论 -
2021年1月24日10:27:37 回文数(问题)
/* 2021年1月24日09:08:34 回文数 若一个数(首位不为零)从左向右读与从右向左读都一样,我们就将其称之为回文数。例如:给定一个10进制数56,将56加65(即把56从右向左读),得到121是一个回文数。又如:对于10进制数87:STEP1:87+78 = 165 STEP2:165+561 = 726STEP3:726+627 = 1353 STEP4:1353+3531 = 4884在这里的一步是指进行了一次N进制的加法,上例最少用了4步得到回文数4884。写.原创 2021-01-24 10:28:36 · 369 阅读 · 0 评论 -
2021年1月23日20:17:47 括号匹配(待完善)
/* 2021年1月23日19:53:51 栈应用: 括号匹配 */#include<stdio.h>#include<stdlib.h> struct stack{ char sign; struct stack* next;};void push(stack** head,char c){ stack* p=(stack*)malloc(sizeof(stack)); p->sign=c; p->next=*head; *he.原创 2021-01-23 20:18:44 · 108 阅读 · 0 评论 -
2021-1-22
原创 2021-01-23 18:54:24 · 72 阅读 · 0 评论 -
2021-01-23
/* 珠心算问题: 描述珠心算是一种通过在脑中模拟算盘变化来完成快速运算的一种计算技术。珠心算训练, 既能够开发智力,又能够为日常生活带来很多便利,因而在很多学校得到普及。某学校的珠心算老师采用一种快速考察珠心算加法能力的测验方法。他随机生成一个正整数集合,集合中的数各不相同,然后要求学生回答:其中有多少个数,恰好等于集合中另外两个(不同的)数之和?最近老师出了一些测验题,请你帮忙求出答案。格式输入格式输入共两行,第一行包含一个整数 n,表示测试题中给出的正整数个数。第二行.原创 2021-01-23 18:50:22 · 192 阅读 · 0 评论 -
2021-01-23
/* 记数问题*/#include<stdio.h>void count(int i,int x,int *cnt){ int r; while(i) { r=i%10; if(r==x) (*cnt)++; i/=10; }}int main(){ int n,x,cnt=0; scanf("%d%d",&n,&x); for(int i=1;i<=n;i++) count(i,x,&cnt); prin.原创 2021-01-23 17:21:03 · 61 阅读 · 0 评论 -
2021年1月22日20:48:41LCS问题
/* key to LCS problem bug1:当输入s1,s2长度不一致时,答案运行不出来 2020-1-22*/#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char s1[100]={0},s2[100]={0}; int x,y,max=0; printf("please input s1:"); gets(s1); printf("pleas.原创 2021-01-22 20:49:47 · 163 阅读 · 4 评论 -
20201-1-21
原创 2021-01-22 16:32:27 · 83 阅读 · 0 评论 -
寒假打卡计划
1.学习c++,做笔记2.学习数据结构与算法3.英语六级4.阅读5.力扣刷题!!!每天打卡汇报成果原创 2021-01-22 16:13:00 · 194 阅读 · 0 评论