Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
1f00505
Update main.cpp
Biuviu Apr 2, 2021
7ced164
test
Biuviu Apr 14, 2021
9a9338c
Merge remote-tracking branch 'upstream/master'
Biuviu Apr 15, 2021
f7680ec
xx
Biuviu Apr 15, 2021
c83b380
Delete HelloWorld.cpp
Biuviu Apr 15, 2021
19886af
Create HelloWorld.cpp
Biuviu Apr 15, 2021
fd6d1a0
Update SuperPrime-HW2.cpp
Biuviu Apr 17, 2021
761d853
update
Biuviu Apr 17, 2021
e891fc6
Update SuperPrime-HW2.cpp
Biuviu Apr 17, 2021
1ffcad9
Update SuperPrime-HW2.cpp
Biuviu Apr 17, 2021
52f147e
update
Biuviu Apr 20, 2021
f154d6b
继承
Apr 20, 2021
421cd25
Update SuperPrime-HW2.cpp
Biuviu Apr 20, 2021
f9113c7
Update SuperPrime-HW2.cpp
Biuviu Apr 20, 2021
fa300d2
Update SuperPrime-HW2.cpp
Biuviu Apr 20, 2021
b25caa9
hh
Biuviu Apr 20, 2021
967da80
Update SuperPrime_HW2.cpp
Biuviu Apr 20, 2021
62aec7e
Update SuperPrime_HW2.cpp
Biuviu Apr 20, 2021
c74be46
update
Biuviu Apr 23, 2021
d27e04f
Update SuperPrime_HW2.cpp
Biuviu Apr 23, 2021
ddae170
hll
Biuviu Apr 23, 2021
c728e6c
Update SuperPrime_HW2.cpp
Biuviu Apr 23, 2021
2c790e5
hw12
Biuviu Apr 25, 2021
3e4e21a
hw12
Biuviu Apr 25, 2021
799bf2f
hw12
Biuviu Apr 25, 2021
2da15b4
hw12
Biuviu Apr 25, 2021
7778206
hw12
Biuviu Apr 25, 2021
6ecc3b2
hw12
Biuviu Apr 25, 2021
3c96f36
1930
Biuviu Apr 25, 2021
22d9cee
Update SuperPrime_HW2.cpp
Biuviu Apr 25, 2021
7e378fe
Update SuperPrime_HW2.cpp
Biuviu Apr 25, 2021
b5efd1a
Homework3
Apr 27, 2021
f3b2a36
Operator Overload
May 11, 2021
61ffa3f
merge remote-tracking branch 'upstream/master'
Biuviu May 14, 2021
97bbec7
Merge branch 'master' of https://github.com/Biuviu/hello-world
Biuviu May 14, 2021
9c3ba0c
test
Biuviu May 14, 2021
0132086
remove
Biuviu May 14, 2021
ab25034
Create SuperPrime_HW.cpp
Biuviu May 14, 2021
d39122b
Create SuperPrime_HW2.cpp
Biuviu May 14, 2021
87bf9a6
Merge pull request #162 from Biuviu/master
Dashark May 14, 2021
03f3027
Function Object && const && static
May 18, 2021
875f947
学生代码
May 25, 2021
08b51bd
helloworld add commit
Link-aka Jun 23, 2021
5e49331
丢失了上一个版本
Dashark Sep 26, 2021
e6a14df
Create leapyear1.cpp
Sep 29, 2021
25d61a8
Update leapyear1.cpp
Sep 29, 2021
ee0adb0
Update leapyear1.cpp
Sep 29, 2021
720688e
Update leapyear1.cpp
Sep 29, 2021
ecc2342
Update leapyear1.cpp
Sep 29, 2021
01acbaf
Update Course-3.cpp
Sep 29, 2021
0315bf7
Update Course-3.cpp
Sep 29, 2021
2ddb020
Update Course-3.cpp
Sep 29, 2021
1c0c058
Updated spelling
nikhilcse Oct 17, 2021
1bcf4ef
作业一
Dashark Oct 29, 2021
4167ca4
作业二
Dashark Oct 29, 2021
c31d024
作业三
Dashark Nov 4, 2021
8f637c4
作业四
Dashark Nov 4, 2021
d69a7d5
Merge pull request #165 from nikhilcse/patch-1
Dashark Nov 10, 2021
981d9d0
Merge pull request #164 from Link-aka/master
Dashark Nov 10, 2021
439c582
作业五
Dashark Nov 14, 2021
0d27443
Merge branch 'master' of github.com:Dashark/hello-world
Dashark Nov 14, 2021
52c5049
作业六
Dashark Nov 21, 2021
17deb37
一些记录
Dashark Dec 21, 2021
aa80457
SuperPrime实现
Dashark Mar 23, 2022
262d6a7
计划搞一个大纲
Dashark Apr 12, 2022
d99c778
一周小结
Dashark Apr 13, 2022
f45b27e
第9周课程
Dashark Apr 19, 2022
61d8904
Eigen的类图
Dashark Apr 24, 2022
f4ccd70
有点混淆
Dashark Apr 25, 2022
de13b94
多重继承与混杂模式
Dashark May 6, 2022
b20995d
Mixins和CRTP的大纲
Dashark May 10, 2022
51f5786
Mixins with CRTP
Dashark May 13, 2022
23ecb67
接口变更
Dashark May 17, 2022
3d790c0
交换两个变量的值
Oct 18, 2022
7ca2fbb
做了一个贾代马
Oct 18, 2022
84ade2a
条件语句
Oct 18, 2022
e00b07a
条件排序
Oct 18, 2022
c22611a
期末考试题
Dec 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Course-3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//求一元二次方程的根
// 例如 :y = x2 + 10x + 17
// 当 x = 2, 求 y = 41
// 当 y = 2, 求 x = ?
#include <stdio.h>
#include <math.h>
float mysqrt(float n) {
// how to guess
float x = n/2;
while(...) {
if (x*x > n)
x = x/2;
else
x = (x+n)/2;
}
return 0.0f;
}
int main() {
float x1, x2;
float y, a, b, c, temp;
printf("Please input \n");
scanf("%f %f %f %f", &y, &a, &b, &c);
c = c - y;
temp = b*b - 4* a*c;
if(temp >= 0) {
temp = sqrt(temp);
a = 2 * a;
x1 = (-b + temp)/(a);
x2 = (-b - temp)/(a);
printf("Results \n");
printf("%f\n", x1);
printf("%f\n", x2);
}
else
printf("No Results \n");
return 0;
}
16 changes: 16 additions & 0 deletions Eigen/plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml

PlainObjectBase <|-- Matrix
PlainObjectBase <|-- Array

MatrixBase <|-- PlainObjectBase
ArrayBase <|-- PlainObjectBase

DenseBase <|-- MatrixBase
DenseBase <|-- ArrayBase

DenseCoeffsBase <|-- DenseBase

class EigenBase <<Derived>>
EigenBase <|-- DenseCoeffsBase
@enduml
69 changes: 69 additions & 0 deletions FCdemo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#include <algorithm>
#include <iostream>
#include <set>
#include <unordered_set>
#include <string>
#include <vector>
// -std=c++11
using namespace std;
//constant
class Person
{
public:
Person(string lastname, string firstname)
: _firstname(firstname), _lastname(lastname)
{
}
string firstname() const
{
return _firstname;
}
string lastname() const
{
return _lastname;
}
private:
const string _firstname = nullptr;
const string _lastname = nullptr;
};

class PersonSortCriterion
{
public:
bool operator()(const Person &p1, const Person &p2) const
{
return p1.lastname() < p2.lastname() ||
(p1.lastname() == p2.lastname() && p1.firstname() < p2.firstname());
}
};
class PersonSortCriterion1
{
public:
bool operator()(const Person &p1, const Person &p2) const
{
return p1.lastname() > p2.lastname() ||
(p1.lastname() == p2.lastname() && p1.firstname() > p2.firstname());
}
};

int main(void)
{
set<Person, PersonSortCriterion1> coll;
//unordered_set<Person> coll;
Person p1("yu", "g");
Person p2("an", "yu");
Person p3("xiao", "ming");
Person p4("xi", "biaoge");
Person p5("u", "ong");
coll.insert(p1);
coll.insert(p2);
coll.insert(p3);
coll.insert(p4);
coll.insert(p5);
for (auto i : coll)
{
cout << i.lastname() << ", " << i.firstname() << endl;
}

return 0;
}
22 changes: 19 additions & 3 deletions HelloWorld.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#include <stdio.h>
int main() {
printf("Hello World!\n");

//try Jenkins again
int x, y, z, temp;
// �����������������մӴ�С���
scanf("%d %d %d", &x, &y, &z);
if ( y < z ) {
temp = y;
y = z;
z = temp;
}
else if ( x < y ) {
temp = x;
x = y;
y = temp;
}
else if ( y < z ) {
temp = y;
y = z;
z = temp;
}
printf("%d, %d, %d\n", x, y, z);
return 0;
}
72 changes: 72 additions & 0 deletions Mixins.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* 组合模式
* 在 TaggableImpl 中实现打标签的逻辑
* Post 类和 TaggableImpl 类都实现 Taggable 接口
* Post 类中创建一个 TaggableImpl 实例并在实现 Taggable 时将相应方法调用委托过去。
*/


import java.util.List;
import java.util.ArrayList;

interface Entity {
public int getId();
public int getKind();
}

interface Taggable {
public void addTag(int tagId);
public List<Integer> getTags();
}

class TaggableImpl implements Taggable {
private Entity target;

public TaggableImpl(Entity target) {
this.target = target;
}

public void addTag(int tagId) {
int id = target.getId();
int kind = target.getKind();
System.out.println("insert into ... values "
+ id + ", "
+ kind + ", "
+ tagId + ")");
}

public ArrayList<Integer> getTags() {
// query from database
return new ArrayList<Integer>();
}
}

class Post implements Entity, Taggable {
public final static int KIND = 1001;

private Taggable taggable;
private int id;
private String title;

public Post(int id, String title) {
this.id = id;
this.title = title;
this.taggable = new TaggableImpl(this);
}

public int getId() {
return id;
}

public int getKind() {
return KIND;
}

public void addTag(int tagId) {
taggable.addTag(tagId); // delegate
}

public ArrayList<Integer> getTags() {
return taggable.getTags(); // delegate
}
}
45 changes: 45 additions & 0 deletions Operator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include <iostream>
class Parent {
public:
Parent(int n) {
flag = n;
std::cout << "Parent()" << flag << std::endl;
}
virtual ~Parent(){
std::cout << "~~~Parent()" << flag << std::endl;
}
//other methods????
void show();
private:
//attributes??
int flag;
};
class Child : public Parent {
public:
Child(int n):Parent(n) {
flag = n;
std::cout << "Child()" << n << std::endl;
}
virtual ~Child(){
std::cout << "~~~Child()" << flag << std::endl;
}
//other methods????
//function object
void operator() (int n) {
}
private:
//attributes??
int flag;
void operator= (const Child &c) {
std::cout << "operator = " << flag << std::endl;
}
};
int main() {
Parent *p;
p = new Child(1);
Child c(2);
//c = Child(3);
//p->?????();
delete p;
return 0;
}
2 changes: 2 additions & 0 deletions PQPrime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// 求 p 和 q
// 当 p 和 q 都是素数,求 p 和 q
3 changes: 3 additions & 0 deletions PQPrime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$p^q + q^p$是一个素数,
$p$和$q$也是素数,
求$p$和$q$
81 changes: 81 additions & 0 deletions Plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 8th Week
- OOD:矩阵
- 方法:加、减、点乘、叉乘
- 属性:随便
- 动作:学生讲解作业(属于评估)

## Activities
1. 学生讲解矩阵代码
2. 分析矩阵的属性定义:数组,容器,Eigen实现
3. Eigen的继承:Curiously recurring template pattern (CRTP),奇特的递归模板模式
1. 颠倒继承(Upside Down Inheritance),它的效果与“传统继承是通过派生类向基类添加功能”的应用正好相反的。
2. 不使用虚函数但是达到了多态的效果,大量应用于各种库中,比如Eigen库,WTL库。它没有虚函数的开销。
4. 展示Eigen中Matrix的数据结构:实际上展示不下去,没法做
5. 实际中看文档,读代码,照样使用Eigen库编程。
6. 通过读源代码,学习一些新技术。

## 结果
自我感觉效果好,交互太少,以上内容根本没讲完。CRTP只讲了开头。

# 9th Week

作业:在上周矩阵的基础上,计算欧氏距离,周末再给。

周末忘记给作业,学生说没时间做。

CRTP的多态效果,与标准的多态比较。

Matrix的运算符重载,特别是()的重载。

## Activities
1. 多态的演示代码。优缺点。
2. CRTP的演示代码,实现相同的多态。扩展static_cast
3. Eigen库中CRTP应用。
4. Matrix中的运算符重载。
5. ()的重载

## 结果
课程的内容有点混乱。

# 10th Week

作业:匈牙利算法

本周日补五一的课程,计划有点混乱了。

有个学生跑别的班听基础内容了,好像我讲得内容有点超越学生的认知了。

## Activities
1. Eigen里代码的继承关系与展示,Matrix 和 Array
2. 先找Eigen文档里关于 Matrix 和 Array 的说明
3. 清理 Eigen 的源代码,Copy 出来单独展示与说明
4. 画一个 PlantUML 的简要模型

# 11th Week

多重继承与 Mix in-class 编程

## Activities

1. C++的多重继承代码展示
2. Java版本的Mixins模式代码展示

## 结果

估计同学们没有听懂

# 12th Week

作业:把Java版本的Mixins写成C++版本的。

## Activities

1. 讲解C++版本的Mixins代码
2. 将C++的多重继承重构为模板类的继承
1. Persons作为Students的基类,具有学习的能力。Students<Persons>
2. Faculties作为Persons的子类,具有教书的能力。Faculties<Persons>
3. TAs本质是学生,具有Faculties的教书能力。Faculties<Students<Persons>>
3. 将CRTP的设计应用
1. Persons就是Students。
2. Persons就是Faculties。
3. Persons也是TAs,Students就是TAs,TAs也是Faculties。
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# hello-world
# Hello-World
C/C++编程初学者

# Git手册
Expand All @@ -17,4 +17,4 @@ git log --author="$(git config --get user.name)" --pretty=tformat: --numstat | g
git shortlog -s
```

[Code Reference](https://github.com/WangShouDao/count_github_push)
[Code Reference](https://github.com/WangShouDao/count_github_push)
Loading