/heart-curve-cplusplus

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

Primary LanguageC++

##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!

个人网站liuyubobobo.com

电子邮件liuyubobobo@gmail.com

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

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

知乎专栏:是不是很酷 https://zhuanlan.zhihu.com/liuyubobobo

个人公众号:是不是很酷:)

QRCode