当前位置:网站首页>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!
边栏推荐
- volatile内存语义以及实现 -volatile写和读对普通变量的影响
- Redis counts new and retained users
- 微软 AI 量化投资平台 Qlib 体验
- addressable in Golang
- Know the showTimePicker method of the basic components of Flutter
- PMP WeChat group daily exercises
- 顺序表的实现
- A brief introduction to the CheckBox component of the basic components of Flutter
- [C language] Preprocessing operation
- (线段树) 基础线段树常见问题总结
猜你喜欢
【C语言进阶】文件操作(一)
pom文件成橘红色未加载的解决方案
已解决:不小心卸载pip后(手动安装pip的两种方式)
(8) Math class, Arrays class, System class, Biglnteger and BigDecimal classes, date class
高等数学---第九章二重积分
强化学习:从入门到入坑再到拉屎
idea工程明明有依赖但是文件就是显示没有,Cannot resolve symbol ‘XXX‘
立足本土,链接全球 | 施耐德电气“工业SI同盟”携手伙伴共赴未来工业
[C language] General method of base conversion
IDEA common shortcut keys and plug-ins
随机推荐
(五)final、抽象类、接口、内部类
浅识Flutter 基本组件之showDatePicker方法
(6) Enumeration and annotation
(八)Math 类、Arrays 类、System类、Biglnteger 和 BigDecimal 类、日期类
addressable in Golang
Component pass value provide/inject
[Swift] Customize the shortcut that pops up by clicking the APP icon
qlib自动化quant
qlib架构
日志级别 和 打印log注意
[C language] General method of expression evaluation
(Line segment tree) Summary of common problems of basic line segment tree
binom二项分布,
《DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction》论文笔记
Redis uses LIST to cache the latest comments
[shell basics] determine whether the directory is empty
els block to the right
Why SocialFi achievement Web3 decentralized social in the future
安全20220718
$parent/$children and ref