当前位置:网站首页>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!
边栏推荐
- What is a system?
- 高等数学---第九章二重积分
- Can't load /home/Iot/.rnd into RNG
- interprocess communication
- Learning DAVID Database (1)
- MATLAB/Simulink&&STM32CubeMX工具链完成基于模型的设计开发(MBD)(三)
- Knowledge Distillation 7: Detailed Explanation of Knowledge Distillation Code
- Redis uses LIST to cache the latest comments
- Good place to download jar packages
- A brief introduction to the showDatePicker method of the basic components of Flutter
猜你喜欢

mysql基础知识(二)

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

Mysql 45 study notes (twenty-five) MYSQL guarantees high availability

递归实现汉诺塔问题

Detailed explanation of TCP (2)

With 7 years of experience, how can functional test engineers improve their abilities step by step?

Safety 20220712

高等数学---第九章二重积分

《DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction》论文笔记

The BP neural network
随机推荐
(6) Enumeration and annotation
Redis uses sorted set to cache latest comments
Component pass value provide/inject
BUG definition of SonarQube
errno error code and meaning (Chinese)
VS QT - ui does not display newly added members (controls) || code is silent
Regarding the primary key id in the mysql8.0 database, when the id is inserted using replace to be 0, the actual id is automatically incremented after insertion, resulting in the solution to the repea
强化学习:从入门到入坑再到拉屎
Redis uses LIST to cache the latest comments
TCP和UDP详解
No qualifying bean of type 问题
(五)final、抽象类、接口、内部类
扫雷游戏(c语言写)
Bubble sort, selection sort, insertion sort, binary search directly
[C language] Preprocessing operation
[C language] Three-pointed chess (classic solution + list diagram)
问题1:给你1-10的列表,实现列表输出,单数在左边,双数在右边。
Redis implements distributed locks
已解决:不小心卸载pip后(手动安装pip的两种方式)
【小土堆补充】Pytorch学习笔记_Anaconda虚拟环境使用