当前位置:网站首页>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!
边栏推荐
- 问题7:列表的拼接
- LocalDate加减操作及比较大小
- A brief introduction to the CheckBox component of the basic components of Flutter
- 立足本土,链接全球 | 施耐德电气“工业SI同盟”携手伙伴共赴未来工业
- 慧通编程第4关 - 魔法学院第6课
- endian mode
- Day32 LeetCode
- "DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction" paper notes
- els block to the left to move the conditional judgment
- Knowledge Distillation 7: Detailed Explanation of Knowledge Distillation Code
猜你喜欢
Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
type_traits metaprogramming library learning
Database implements distributed locks
pom文件成橘红色未加载的解决方案
$attrs/$listeners
端口排查步骤-7680端口分析-Dosvc服务
递归实现汉诺塔问题
(5) final, abstract class, interface, inner class
「 每日一练,快乐水题 」1331. 数组序号转换
Detailed explanation of TCP (2)
随机推荐
Redis uses sorted set to cache latest comments
"A daily practice, happy water problem" 1331. Array serial number conversion
qlib自动化quant
Zotero如何删除自动生成的标签
Database implements distributed locks
【AUTOSAR-RTE】-4-Port and Interface and Data Type
「 每日一练,快乐水题 」1331. 数组序号转换
A brief introduction to the CheckboxListTile component of the basic components of Flutter
[Swift] Customize the shortcut that pops up by clicking the APP icon
C语言从入门到如土——数据的存储
[C language] General method of base conversion
three.js 制作3D相册
(线段树) 基础线段树常见问题总结
SIP协议标准和实现机制
浅识Flutter 基本组件之showDatePicker方法
The els block moves the boundary to the right, and accelerates downward.
Implementation of a sequence table
C primer plus study notes - 8, structure
Safety 20220718
pom文件成橘红色未加载的解决方案