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

winner8080 2010-05-21 12:37:26
如题
...全文
2255 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………………

69,371

社区成员

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

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