大家好!帮我看看咯!第一个printf怎么没有输出来?

来源:百度知道 编辑:UC知道 时间:2024/09/20 11:54:33
#include"stdio.h"
void main()
{
printf("I love");
printf("\r");
printf("show me the money");

}

你输出了一个 \r,
这个是将当前位置移到本行的开头
也就是无论本行前面输出多少都会被它覆盖掉。。

楼上所说的修改是无用的。。。
你只能在 I love 后面加一个换行才行
不然加上的东西还是会被覆盖掉。。

printf("I love\n");
printf("\r");
printf("show me the money");

其实这样的话就用不上 \r 了

\r的意思是:回车,将当前位置移到前一列
这句话的意思就是\r使当前位置回到本行开头,自此输出的字符将取代与来屏幕上的改位置上显示的字符。
所以show me the money取代了I love的位置
如果想让I love输出,就在I love前面加几个空格

#include"stdio.h"
void main()
{
printf("I love\n");
printf("\r");
printf("show me the money");

}