Skip to content

Commit

Permalink
2022-5-8 23:25:58
Browse files Browse the repository at this point in the history
  • Loading branch information
youhuangla committed May 8, 2022
1 parent 704918d commit fcca697
Show file tree
Hide file tree
Showing 17 changed files with 203 additions and 3 deletions.
Binary file added algorithm/img/image-20220508171355604.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added algorithm/img/image-20220508174244755.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions algorithm/leap_year.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# leap year

## day of year

![image-20220508174244755](img/image-20220508174244755.png)

```c
#include <stdio.h>
int main() {
int y, m, d;
scanf("%d.%d.%d", &y, &m, &d);
//printf("%d.%d.%d", y, m, d);
int leap;
//judge leap year
if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) {
leap = 1;
} else {
leap = 0;
}

//day of month
int month[13] = {0,/*skip 0 month*/
31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
};

//if you forget that the febrary of leap year should be 29,you should remenber the joke that somebody
//only have a birthday every four years.

//leap year impact day of month
if (leap == 1) {
month[2] += 1;
}

//count the day of year according to month
int day_of_year = 0;
for (int i = 1; i < m; i++) {//bug: january will not plus month[1]!
day_of_year += month[i];
}

//plus day of the month
day_of_year += d;
printf("第%d天", day_of_year);

return 0;
}
```

```output
2008.10.3
第277天
```

41 changes: 41 additions & 0 deletions algorithm/prime_number.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,47 @@ int main() {
}
```

### 绝对素数

[信息学奥赛一本通(C++版)1153:绝对素数](http://ybt.ssoier.cn:8088/problem_show.php?pid=1153)

![image-20220508171355604](img/image-20220508171355604.png)

```c
#include <stdio.h>

#define MAX_N 105
int prime[MAX_N];//0 is prime

void prime_sieve() {
for (int i = 2; i < MAX_N; i++) {
if (prime[i] == 0) {
for (int j = 2 * i/*not begin int i, if so, j will be marked not prime*/; j < MAX_N; j += i) {
prime[j] = 1;//not prime
}
}
}
return ;
}

int main() {
prime_sieve();
for (int i = 10; i < 100; i++) {
if (prime[i] == 0) {
int j = i % 10 * 10 + i / 10;
if (prime[j] == 0) {
printf("%d,", i);
}
}
}
return 0;
}
```

```shell
11,13,17,31,37,71,73,79,97,
```

### 计数素数count-primes

[204. 计数质数 - 力扣(LeetCode) (leetcode-cn.com)](https://leetcode-cn.com/problems/count-primes/submissions/)
Expand Down
Empty file added c_class/proj/Github.md
Empty file.
Binary file added c_class/proj/img/image-20220508213553533.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions c_class/proj/my_gtest.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# My gtest

## 谷歌测试框架

GoogleTest 是一个由谷歌开发的 c++ 测试和模拟框架,目前在github上已有 25.7k 的 star。

![image-20220508213553533](img/image-20220508213553533.png)

[google/googletest: GoogleTest \- Google Testing and Mocking Framework](https://github.com/google/googletest)

[GoogleTest User’s Guide \| GoogleTest](https://google.github.io/googletest/)

本文主要为[人人都能学会的编程入门课 (geekbang.org)](https://time.geekbang.org/column/intro/100043901?tab=catalog)的学习笔记,并在胡船长代码的基础上进行了些微的整理与完善。如有侵权请联系我删除。

## 软件开发流程

在开始做项目之前呢,让我们先来了解下一般的项目开发流程。
Expand Down Expand Up @@ -77,8 +89,8 @@ int main(int argc, char *argv[]) {
```
```shell
youhuangla@Ubuntu c_lab % g++ gtest_test.cpp -lgtest -lpthread [0]
youhuangla@Ubuntu c_lab % ./a.out [0]
g++ gtest_test.cpp -lgtest -lpthread
./a.out
```

```shell
Expand Down
Binary file added vscode/img/image-20220508214746820.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode/img/image-20220508215122770.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode/img/image-20220508215557397.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode/img/image-20220508220108564.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode/img/image-20220508220224812.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode/img/image-20220508220335740.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vscode/img/image-20220508220402535.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions vscode/initialised_github_repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[Version Control in Visual Studio Code](https://code.visualstudio.com/docs/editor/versioncontrol)

![image-20220508214746820](img/image-20220508214746820.png)

![image-20220508215122770](img/image-20220508215122770.png)

无脑三件套失败。。。

```shell
git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

git remote add <name> <url>

and then push using the remote name

git push <name>
```

别忘记首先在 vscode 上登陆 github!

![image-20220508215557397](img/image-20220508215557397.png)

publish 后会弹出一个可以让你转到 github 对应的 repo 的链接。

![image-20220508220224812](img/image-20220508220224812.png)

然后

<img src="img/image-20220508220108564.png" alt="image-20220508220108564" style="zoom: 50%;" />



[what is "Would you like to enable auto fetching of Git repositories?" · Issue \#40282 · microsoft/vscode](https://github.com/microsoft/vscode/issues/40282)

那么先不管他们,直接用朴素的方法新建吧!

![image-20220508220335740](img/image-20220508220335740.png)

<img src="img/image-20220508220402535.png" alt="image-20220508220402535" style="zoom:50%;" />

```shell
PS E:\github\mini_gtest> git pull
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/youhuangla/mini_gtest
a8766f4..7ddbcab master -> origin/master
Updating a8766f4..7ddbcab
Fast-forward
README.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 README.md
```

愉快的无脑三件套吧!

```shell
git add .
git commit -a
git push
```

30 changes: 29 additions & 1 deletion web/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

笔记地址:[Note/github\.md at main · youhuangla/Note](https://github.com/youhuangla/Note/blob/main/web/github.md)

[TOC]

## 1.搜索

github高级搜索功能
Expand Down Expand Up @@ -102,4 +104,30 @@ https://github.com/nginx/nginx => https://gitpod.io/#/github.com/nginx/nginx

![image-20220505001029728](img/image-20220505001029728.png)

再纪念一下up主回复(~ ̄▽ ̄)~<img src="img/image-20220505001420933.png" alt="image-20220505001420933" />
再纪念一下up主回复(~ ̄▽ ̄)~<img src="img/image-20220505001420933.png" alt="image-20220505001420933" />

## 更新:从 mini_gtest 的 github 实践

该文档已经更新到[youhuangla/mini\_gtest](https://github.com/youhuangla/mini_gtest)

[5个隐藏的GitHub神技巧,助你秒变大佬!_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1q54y1f7h6?spm_id_from=333.337.search-card.all.click)来自程序员鱼皮的视频中,看完了视频,惊觉十分有用(当年我自己探索的时候被各种环境劝退过)。于是决定记下笔记,当一次“课代表”,所以我就(顺势)开源(复制)了我自己笔记地址:[Note/github.md at main · youhuangla/Note](https://github.com/youhuangla/Note/blob/main/web/github.md)

当时原本只是想着给大家做个图文参考,后来 star 的越来越多,竟然还有 fork 的 Σ(゚д゚;),属实把我吓到了。由于该仓库是我的(白嫖)github做笔记及的的仓库,所以里面的笔记良莠不齐,有很多写代码时随意记录的文档,所以被 fork 了感觉挺尴尬的,所以另开一个较小的仓库将鱼皮视频的笔记放进来,毕竟为了单独下载一个小小的 md 文档,属实没必要整个 fork 我那杂乱的笔记(对网速不好的同学来说我相信更是一种煎熬)。

所以在这里将鱼皮视频的笔记加到了这个小仓库里,临时整合了我自己学习,[人人都能学会的编程入门课 (geekbang.org)](https://time.geekbang.org/column/intro/100043901?tab=catalog)的学习笔记。

原项目名气大(谷歌出品,原仓库 25.7k star),据说工程中也常常用到。

[![image-20220508213553533](img/image-20220508213553533.png)](https://github.com/youhuangla/mini_gtest/blob/master/img/image-20220508213553533.png)

[google/googletest: GoogleTest - Google Testing and Mocking Framework](https://github.com/google/googletest)

[GoogleTest User’s Guide | GoogleTest](https://google.github.io/googletest/)

我根据课程仿写的这个项目的特点:

1. 依赖较少,对只会 C 语言又想做项目的小白友好
2. 理解一些软件工程的思想~~也许可以对面试官吹水~~
3. 如果是一个自己的项目也可以轻易地在最后调用(毕竟很多语言都能调用C语言),让面试官眼前一亮~~装个小b~~,让你的项目锦上添花。ヾ(≧▽≦*)o

所以,如果要 fork 或 star,请 fork 或 star 这个仓库吧,感谢各位大哥的厚爱了( ̄▽ ̄)ノ
Binary file added web/img/image-20220508213553533.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fcca697

Please sign in to comment.