当前位置:网站首页>C语言刷题 | 用putchar输出Love(14)
C语言刷题 | 用putchar输出Love(14)
2022-06-22 09:10:00 【C语言小火车】
例14:C语言实现先后输出Love四个个字符。
解题思路:定义4个字符变量,分别赋以初值L、o、v、e’,然后用putchar函数输出4个字符变量的值。
源代码演示:
#include<stdio.h>
int main()
{
char character1,character2,character3,character4;//定义字符变量
character1='L';//初始化变量,将字符L赋值给character1
character2='o';//初始化变量,将字符o赋值给character2
character3='v';//初始化变量,将字符v赋值给character3
character4='e';//初始化变量,将字符e赋值给character3
putchar(character1);//输出字符L
putchar(character2);//输出字符o
putchar(character3);//输出字符v
putchar(character4);//输出字符e
putchar('\n');//换行
return 0;//函数返回值为0
}编译结果:
Love
--------------------------------
Process exited after 0.06673 seconds with return value 0
请按任意键继续. . .在上述代码中哦可以看出:用putchar函数既可以输出能在显示器屏幕上显示的字符,也可以输出屏幕控制字符,如putchar('\n')的作用是输出一个换行符,使输出的当前位置移到下一行的开头。
边栏推荐
- My first go program
- PHP online common color comparison table
- What is defi and what mode is defi?
- pytorch OSError: DLL load failed: 问题解决方法
- Detailed explanation and Simulation of string and memory operation functions
- kali木马入侵win7系统
- 无线路由攻击和WiFi密码破解实战[渗透技术]
- copy_from_user和copy_to_user
- 让你轻松上手【uni-app】
- CF1267G Game Relics
猜你喜欢

ffmpeg之volumedetect

面试突击59:一个表中可以有多个自增列吗?

文件小能手---multer

医疗信息管理系统数据库--MySQL

yolov5 export Gpu推理模型导出

Sound and shadow 2022 heavy release! Detailed explanation of the new functions of Huisheng Huiying 2022

Thoroughly understand my SQL index knowledge points

Solidity from introduction to practice (IV)
![[detailed explanation] point multiplication and cross multiplication of neural network matrix (pytorch version)](/img/17/e964216d81555d0a1203ee51d4698e.png)
[detailed explanation] point multiplication and cross multiplication of neural network matrix (pytorch version)

Guide to quick withdrawal and withdrawal of us and Hong Kong stocks
随机推荐
IP address (IPv4)
12 yuan sharing mode
Use record of rabbit nest
Monaco editor format JSON, SQL
函数总结(1)
进程状态汇总
Flask blog practice - integrated rich text editor quill
Off line identification of least square method
Manually mining XSS vulnerabilities
Express bird of Express query demonstration code (php+curl)
文件小能手---multer
Medical information management system database mysql
18 intermediary model
Thread. Source code analysis of start() method
Why can MySQL indexes improve query efficiency so much?
container_of
开发报错记录
三个不同线程顺序打印ABC十种写法【并发编程JUC】
PHP de duplication and arrange complete small functions in descending order of length
让你轻松上手【uni-app】