当前位置:网站首页>C language confession code?
C language confession code?
2022-07-31 04:01:00 【Programming fish six six six】

Problem-solving ideas: I have divided this example into 4 parts, part of the first 3 lines, part of lines 4-6, part of lines 7-13, and part of the last line. Readers please read the notes carefully.Xiaolin wrote very detailed.
The first three lines of output, just to let beginners know that even the dumbest method can be printed.

Lines 4-6, these three lines have the same output effect.
for(i=0;i<3;i++){for(j=0;j<29;j++){printf("*");}printf("\n");}Last line, just output a *.
for(i=0;i<14;i++){printf(" ");}printf("*\n");Source code demo: Please refer to the above screenshots for the first three lines of code style. The source code spaces in the article are a little buggy:
#include//Header fileint main()//main function entry{printf("**** ****\n");//Print the first lineprintf(" ********* *********\n");//Print the second lineprintf("**************** *************\n");//Print the third lineint i,j;//Define variablesfor(i=0;i<3;i++)//Print 4-6 lines, a total of 3 lines, so i is less than 3{for(j=0;j<29;j++)//limit the number of output * per line{printf("*");//These three lines only print *, no spaces}printf("\n");//After printing a line, you need to wrap}for(i=0;i<7;i++) //Print 7-13 lines, a total of 7 lines, so i is less than 7{for(j=0;j<2*(i+1)-1;j++)//This for loop is parallel to the following for{printf(" ");//print spaces}for(j=0;j<27-i*4;j++)//The reader can bring in several numbers to find the conditions{printf("*");//print*}printf("\n");}for(i=0;i<14;i++)//Print the * of the last line{printf(" ");//print spaces}printf("*\n") ;//print*return 0;} Compiling and running results are as follows:

The * in the above code can be replaced by the reader. The reader can try to replace it with this symbol to see if it is feasible, and think about it by yourself.
The second kind of confession source code demonstration:
#include//Header file#include//In order to refer to the pow functionint main()//main function entry{float y, x, z;//Define floating point variablesprintf("I think of you when I'm alone\n");//Prompt statementprintf("I want to hug you when I cry\n");//Prompt statementprintf("I want to pounce on you when I'm happy\n");//Prompt statementprintf("I want to kiss you when I'm excited\n");//Prompt statementprintf("Everything is done in the three-word signature without signing\n");//Prompt statementprintf("\n");//Newlinefor (double y = 2.5; y >= -1.6; y = y - 0.2){for (double x = -3; x <= 4.8; x = x + 0.1){//The following is a ternary operation, please read carefully, || this is or(pow((x*x + y*y - 1), 3) <= 3.6*x*x*y*y*y|| (x>-2.4 && x<-2.1 && y<1.5 && y>-1)|| (((x<2.5 && x>2.2) || (x>3.4 && x<3.7)) && y>-1 && y<1.5)|| (y>-1 && y<-0.6 && x<3.7 && x>2.2)) ? printf("*") : printf(" ");}printf("\n");//Newline}getchar();return 0;//The return value of the function is 0} The results of compilation and running are as follows:

There are many ways to print a heart shape in C language. Readers can try more by themselves. Even using printf line by line is also a way. I can only help you here. My girlfriend still has to find it by herself./p>
The above, if you read the above and think it is helpful to you, please give the editor a thumbs up, so that the editor will also have the motivation to update, thank you all the folks~~
em>C language C++ programming and programming learning baseQQ group: 828339809[Click to enter]
Organize and share (source code of many years of study, project actual combat video, project notes, basic introductory tutorial)
Welcome partners who change careers and learn programming, learn and grow faster with more information than pondering on your own!
边栏推荐
猜你喜欢

web容器及IIS --- 中间件渗透方法1

A brief introduction to the showDatePicker method of the basic components of Flutter

C语言表白代码?
![[Paper reading] Mastering the game of Go with deep neural networks and tree search](/img/4f/899da202e13bd561bbfdbaeebe4d2e.jpg)
[Paper reading] Mastering the game of Go with deep neural networks and tree search

从滴滴罚款后数据治理思考

Notes on the establishment of the company's official website (6): The public security record of the domain name is carried out and the record number is displayed at the bottom of the web page

Web container and IIS --- Middleware penetration method 1

Safety 20220712

IIR filter and FIR filter

高等数学---第九章二重积分
随机推荐
(tree) Last Common Ancestor (LCA)
LocalDate addition and subtraction operations and comparison size
Notes on the establishment of the company's official website (6): The public security record of the domain name is carried out and the record number is displayed at the bottom of the web page
SQL Interview Questions (Key Points)
[AUTOSAR-RTE]-5-Explicit (explicit) and Implicit (implicit) Sender-Receiver communication
Learning DAVID Database (1)
MySQL修改root账号密码
Understanding and Using Unity2D Custom Scriptable Tiles (4) - Start to build a custom tile based on the Tile class (below)
MySQL 8.0.30 GA
SIP Protocol Standard and Implementation Mechanism
endian mode
addressable in Golang
The use of beforeDestroy and destroyed
【AUTOSAR-RTE】-4-Port和Interface以及Data Type
With 7 years of experience, how can functional test engineers improve their abilities step by step?
Zotero如何删除自动生成的标签
[Swift]自定义点击APP图标弹出的快捷方式
高等数学---第九章二重积分
C# 实现PLC的定时器
Unity2D 自定义Scriptable Tiles的理解与使用(四)——开始着手构建一个基于Tile类的自定义tile(下)