Skip to content

lacking1/heart-curve-cplusplus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Happy Valentine's Day in 2017

In this repo, I use C++ to draw a heart shape in the command line console! The code is easy, short and fantastic:)

I've blogged a small article about these codes in imooc.com, one of the toppest MOOC websites in China. You could view this blog here.


files main.cpp and main2.cpp are based on the heart curve equation as follows:

heart shape equation 1

The main.cpp draws a heart shape like this:

main.cpp

The main2.cpp draws a heart shape like this:

main2.cpp

The main3.cpp is based on another different heart curve equation. The equation is as follows:

heart shape equation 2

And the result of main3.cpp is like this:

main3.cpp

Inspired by @甲铁城的卡巴司机 in my class group, I added two more examples - main4.cpp and main5.cpp. Both of them fill the heart shape with characters, using above two heart shape equations. The effects look like as follows:

main4.cpp

main5.cpp

Please enjoy!


If you have more ideas about how to draw a heart shape curve or any other beautiful shape curves, please contact me. I'm looking forward to discussing the beauty of mathematics and computer science with you!

Personal Website: liuyubobobo.com

Email: liuyubobobo@gmail.com

Weibo: 刘宇波bobo http://weibo.com/liuyubobobo

Zhihu: 刘宇波 http://www.zhihu.com/people/liuyubobobo

WeChat: liuyubobobo. Please comment github when you add me as a friend.


个人网站liuyubobobo.com

电子邮件liuyubobobo@gmail.com

微博: 刘宇波bobo http://weibo.com/liuyubobobo

知乎: 刘宇波 http://www.zhihu.com/people/liuyubobobo

微信: liuyubobobo. 请备注 github.

About

This repo uses C++ to "draw" a heart shape in your command line. Happy Valentine's Day!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.2%
  • CMake 6.8%