Skip to content

[fix]fix word error #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion C++/43-编写头文件.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

我们来看 C++ primer 当中提供的一个例子。

现在我们要实现一个将直接坐标转化成极坐标的功能,我们需要定义两个结构体分别表示直角坐标和极坐标,另外还需要实现从直接坐标到极坐标的转化
现在我们要实现一个将直角坐标转化成极坐标的功能,我们需要定义两个结构体分别表示直角坐标和极坐标,另外还需要实现从直角坐标到极坐标的转化

显然相对于主体程序而言,这部分代码是独立的,所以我们可以把它们放入一个单独的 cpp 文件当中。首先要明确的是,main()函数和其他函数都用到了同一个结构体,因此两个 cpp 文件都需要包含该结构体的声明。显然拷贝代码是很糟糕的选择,比较好的做法是将结构体的声明写在头文件当中,通过`#include`语句引入。

Expand Down