c语言如何输出字符变量的 C语言一(1)

分享兴趣,传播快乐,增长见闻,留下美好!亲爱的您,这里是LearningYard新学苑。今天小编为大家带来的是C语言(一):打印与变量。

Share interests, spread happiness,

increase knowledge, and leave good!

Dear you, this is the Learning Yard.

Today, Xiaobian brings you C language (I): printing and variables.

01

第一个程序

(1)环境配置:Dev—C

(2)C语言优势:代码量小、运行速度快、功能强大

C语言劣势:危险性高、开发周期长、可移植性不强

(3)打印Hello world!

c语言如何输出字符变量的 C语言一(2)

c语言如何输出字符变量的 C语言一(3)

01 First procedure

(1) Environment configuration: Dev - C

(2) C language advantages: small code size, fast running speed, powerful functions C language disadvantages: high risk, long development cycle, poor portability

(3) Print Hello world!

02

打印

(1)printf:将指定的内容打印在屏幕上(print format,格式化输出)

(2)\:延续读取,通常使用在一行代码很长的时候

如:

c语言如何输出字符变量的 C语言一(4)

可以得到之上一样的结果

(3)转义字符及其含义

c语言如何输出字符变量的 C语言一(5)

02 Print

(1) printf: print the specified content on the screen (print format, format output)

(2) : continue reading, usually used when a line of code is very long

(3) Escape characters and their meanings

03

变量

(1)变量:确定目标并提供存放空间

(2)变量名:①只能是英文字母和数字或下划线组成

②必须是字母或下划线开头,不能是数字

③区分大小写

④不能使用关键字,如int,if等

(3)数据类型

int:整型

char:字符型

float:单精度浮点型(%.2f 精确到两位小数)

double:双精度浮点型(.9f 11代表数据总宽,9代表精确到小数点后几位)

03 Variable

1) Variable: determine the target and provide storage space

(2) Variable name: ① It can only be composed of English letters and numbers or underscores ② It must start with letters or underscores and cannot be numbers ③ It is case-sensitive ④ It cannot use keywords, such as int, If and other

(3) data type

int: integer

char: character

float: single-precision floating-point type (%. 2f accurate to two decimal places)

double: double-precision floating-point type (% 11.9f 11 represents the total width of the data, 9 represents accurate to several decimal places)

04

代码分享

爱心代码(来源CSDN史迪奇奇龙):

04 code sharing

love code (source: CSDN Stitch Keelung):

#include<stdio.h>

#include<Windows.h>

int main()

{

system(" color 0c");//设计程序颜色

printf("遇见你是一件很开心的事情,爱你哟!!!\n");//打印文字

float x,y,a;//定义变量x,y,a

for(y=1.5f;y>-1;y-=0.1f)

{

for(x=-1.5f;x<1.5f;x =.05f){

a=x*x y*y-1;

putchar(a*a*a-x*x*y*y*y<0.0f?'x':' ');

}

Sleep(150);//停顿函数(1.5秒钟)

putchar('\n'); //换行

}

return 0;

}

运行结果:

Operation results:

c语言如何输出字符变量的 C语言一(6)

END

今天的分享就到这里了。如果您对今天的文章有独特的想法,欢迎给我们留言,让我们相约明天,祝您今天过得开心快乐!

That's all for today's sharing.

If you have unique ideas about today's article,

please leave us a message.

Let's meet tomorrow and wish you a happy day!

翻译:百度翻译参考:《零基础入门学习C语言:带你学C带你飞》、哔哩哔哩小甲鱼视频声明:本文由LearningYard新学苑原创,若有侵权请联系删除

文案&排版:易春秀

审核:闫庆红

,