The romance of love is never out of date – the little romance of programmers

operation result:

Full code:

#include <iostream>
#include <windows.h> 

using namespace std;

int main(){
    float x,y,a;
            a=x*x+y*y -1 ;
             if (a*a*ax*x*y*y*y< 0.0 ) cout << "*" ; //In the heart-shaped area, print "*" 
            else  cout << " " ; // print spaces outside the heart-shaped area
        system( "color 04" ); //The background is black and the character printing color is red 
        cout << endl ;
    cout<<"  I only love you.  "<<endl;
    return 0;

C++ programs can be directly assigned to dev to run~~~

Supplementary content:

By looking at the console color controls , we can see that

The color property is specified by two hexadecimal numbers: the first corresponds to the background and the second corresponds to the foreground.

Each number can be any of the following values:

0 = black 8 = grey
    1 = blue 9 = light blue2
    = green A = light green3
    = light green B = light aqua4
    = red C = light red5
    = purple D = light purple6
    = yellow E = pale yellow7
    = white F = bright white

For example, “system(color 04)” in the code is 0=black as the background and 4=red as the print character color

Leave a Comment

Your email address will not be published. Required fields are marked *