C语言中'\b'这个是代表退格键吗

winner8080 2010-05-21 12:37:26
如题
...全文
2445 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
lixusong 2010-12-01
  • 打赏
  • 举报
回复
yes
\n:换行,将当前位置移到下一行开头(ASCII代码 10)
\t:水平制表,(跳到下一个Tab位置)(一个Tab为8个字符)(ASCII码 9)
\b:退格,将当前位置移到前一列(ASCII码 8)
\r:回车,将当前位置移到本行开头(ASCII码13)
\f:换页,将当前位置移到下页开头(ASCII码12)
qq774097676 2010-05-22
  • 打赏
  • 举报
回复
进来学习一下
atlantise522 2010-05-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 selooloo 的回复:]

确切的说是退格键的作用,并不代表退格键
[/Quote]

此说法是对的。
并不一定有退格的效果。
wxwlll 2010-05-21
  • 打赏
  • 举报
回复
对是退格的效果!
selooloo 2010-05-21
  • 打赏
  • 举报
回复
确切的说是退格键的作用,并不代表退格键
selooloo 2010-05-21
  • 打赏
  • 举报
回复
yes.....
周靖峰 2010-05-21
  • 打赏
  • 举报
回复
TC下显示的是abc abc//就是说\b回退一格
我的空格被省略了,其实abc与abc中间有4个空格
周靖峰 2010-05-21
  • 打赏
  • 举报
回复
\b在TC和VC下的解释是不同的
同样一个语句:printf("abc\t\babc");
TC下显示的是abc abc//就是说\b回退一格
VC下显示的是abcabc//就是说\b将\t回退了

至于如何插入源代码

你将代码加到两个方括号的中间就行了

显示代码

liutengfeigo 2010-05-21
  • 打赏
  • 举报
回复
12楼的是天书,楼主这样的问题其实该去问百度
恶魔 2010-05-21
  • 打赏
  • 举报
回复
12楼的例子很能说明问题哦
sichuanwww 2010-05-21
  • 打赏
  • 举报
回复
char a[100]="yes"
Arkwyd 2010-05-21
  • 打赏
  • 举报
回复
int main() {
printf("abc\bd\n");
printf("abc\b\n");
return 0;
}

输出:
abd
abc

明白了吧,'\b'只能使光标的位置回退,但不能删除之前的字符
赵4老师 2010-05-21
  • 打赏
  • 举报
回复
C++ Character Constants
Character constants are one or more members of the “source character set,” the character set in which a program is written, surrounded by single quotation marks ('). They are used to represent characters in the “execution character set,” the character set on the machine where the program executes.

Microsoft Specific

For Microsoft C++, the source and execution character sets are both ASCII.

END Microsoft Specific

There are three kinds of character constants:

Normal character constants


Multicharacter constants


Wide-character constants
Note Use wide-character constants in place of multicharacter constants to ensure portability.

Character constants are specified as one or more characters enclosed in single quotation marks. For example:

char ch = 'x'; // Specify normal character constant.
int mbch = 'ab'; // Specify system-dependent
// multicharacter constant.
wchar_t wcch = L'ab'; // Specify wide-character constant.

Note that mbch is of type int. If it were declared as type char, the second byte would not be retained. A multicharacter constant has four meaningful characters; specifying more than four generates an error message.

Syntax

character-constant :

'c-char-sequence'
L'c-char-sequence'

c-char-sequence :

c-char
c-char-sequence c-char

c-char :

any member of the source character set except the single quotation mark ('), backslash (\), or newline character
escape-sequence

escape-sequence :

simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence

simple-escape-sequence : one of

\' \" \? \\
\a \b \f \n \r \t \v

octal-escape-sequence :

\octal-digit
\octal-digit octal-digit
\octal-digit octal-digit octal-digit

hexadecimal-escape-sequence :

\xhexadecimal-digit
hexadecimal-escape-sequence hexadecimal-digit

赵4老师 2010-05-21
  • 打赏
  • 举报
回复
cprintf可以退格,printf不一定能退格。
fireyou 2010-05-21
  • 打赏
  • 举报
回复
回复框上有个插入源代码的标签
a564034199 2010-05-21
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 winner8080 的回复:]

在回复的时候,怎么才能像楼上这样见一个C/C++ code的回复框呢.
[/Quote]

我也想问这个问题!!
#include <stdio.h>

int main(void)
{
printf ("Hello word\n");
return 0;
}

看看能插入不。
winner8080 2010-05-21
  • 打赏
  • 举报
回复
在回复的时候,怎么才能像楼上这样见一个C/C++ code的回复框呢.
南气子水 2010-05-21
  • 打赏
  • 举报
回复

#include <stdio.h>
int main()
{
printf("Hello,world!\bHello,C\n");
return 0;
}

输出:HelloworldHello,C
aimsam 2010-05-21
  • 打赏
  • 举报
回复
对,但是要注意如果是上机考试的话用/b实现的显示效果好像判定上是有问题的...
我上学期的C考试就是这样..
sonicrang 2010-05-21
  • 打赏
  • 举报
回复
up………………
含C源程序、Proteus原理图、PCB图、报告 本设计是实现一个有加、减、乘、除、函数计算功能和电子时钟的多功能计算器。它的硬件主要由四部分组成,一个STC89C52单片机芯片,一块LCD1602液晶显示器,一个4*4的盘,各种功能设置按。 软件设计采用C语言编写,实现了14位浮点数内的加、减、乘、除基本的四则运算,带有‘sin’、‘cos’、‘tan’、‘exp’、‘ln’、‘lg’、‘倒数’、‘x^y’、‘sqrt’、‘fmod ’10个常用数学函数运算。此外该计算器除了计算功能以外还具有时钟的功能 设计实物操作说明 1)、开机默认为时钟模式,按CS在计算器和时钟模式之间切换。 2)、时钟:按TS&s可以进行时间的设置,输入格式为 xx。xx。xx , 按‘=’确认,按cs退出设置。 3)、计算器: (1)、’0‘~’9‘、‘.’为数字;+ - * /为运算符号;C 是计算器复位; DEL退格撤销上次入,可连续撤销 M+ 存储有上次运算计算结果和数据Men,按M+输出上次结果, 按TS&s 后再按此输出Men,’M+‘ 加‘TS&s’加‘M+'对数据Men进行更新; TS&s在计算器模式为复用功能,按 一下它在按数字可以调用数字代表的 函数,可以在复用和非复用模式之间转换;标志在左下角 (2)、运算的流程 :(符号)A 运算符 (符号)B A、B是参与运算的数据,可以是入的 数字,也可 以是函数 除了2、3的)和 M+的数据; 符号即+、-号,可带可不带;如果不是按等号得结果而是按运算符,则 本次的运算结果和按的这个运算符成为下次的A 和运算符,从而进行连续计算。 函数说明:Func (符号)C Func为函数,符号为+-,C只能是数字、M+、π 另:fmod和想x^y函数因为要两个参数,当运算符使用。 函数:sin 正弦函数 cos余弦函数 tan正切函数 exp 以e为底的指数函数 ln 自然对数值 lg 以10为底的对数 sqrt 平方根 dao 倒数 π 圆周率当数据使用,前面可以带加权,例 0.5π 度 角度输入 (双参数) x^y x的y次方 (双参数) f% A/B的余数(双精度)

70,012

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧