How to wrap lines in C language

coldplay.xixi
Release: 2020-08-14 10:14:35
Original
34136 people have browsed it

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;
}
Copy after login

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;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template