Home >Backend Development >C#.Net Tutorial >How to wrap lines in C language

How to wrap lines in C language

coldplay.xixi
coldplay.xixiOriginal
2020-08-14 10:14:3534191browse

How to wrap lines in C language: First open the code editor; then add [\r\n] at the end of each output statement. The code is [printf("Try typing a character: \r\n")].

How to wrap lines in C language

C language line wrapping method:

1. Give a chestnut

# include <conio.h>
# include <stdio.h>
int main()
{
    char ch;
    printf("打个字符试试:");
ch = getch();
    printf("你刚输入的是:%c",ch);
printf("按任意键结束");
getch();
return 0;
}

We will I found that the output was on one line

How to wrap lines in C language

2. We added \r\n

at the end of the output statement so that the output can be newline

How to wrap lines in C language

3. Finished product

# include <conio.h>
# include <stdio.h>
int main()
{
    char ch;
    printf("打个字符试试:\r\n");
ch = getch();
    printf("你刚输入的是:%c\r\n",ch);
printf("按任意键结束");
getch();
return 0;
}

Related learning recommendations: C video tutorial

The above is the detailed content of How to wrap lines in C language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn