Simple heart code in c language

angryTom
Release: 2020-03-04 18:07:33
Original
48178 people have browsed it

Simple heart code in c language

Simple heart-shaped code in c language

Use c language to create a heart-shaped pattern. For beginners of C language.

Recommended learning: c language video tutorial

The code is as follows:

#include <stdio.h>
int main() {
    for (float y = 1.5f; y > -1.5f; y -= 0.1f) {
        for (float x = -1.5f; x < 1.5f; x += 0.05f) {
            float a = x * x + y * y - 1;
            putchar(a * a * a - x * x * y * y * y <= 0.0f ? &#39;*&#39; : &#39; &#39;);
        }
        putchar(&#39; &#39;);
    }
}
Copy after login

Running effect:

Simple heart code in c language

For more programming-related tutorials, please pay attention to PHP Chinese website!

The above is the detailed content of Simple heart code in c language. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!