C + + Learning: Special character returns in character type

Source: Internet
Author: User

1. Mandatory type conversion for character type applications:

#include <iostream>
using namespace std;
int main ()
{for
    (int i=32;i<128;i++)
    {
        cout<< (char) i;    
    }
    cout<<endl;
    return 0;
}

Run Result:

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/cplus/

2. Special characters:

The code is as follows:

#include <iostream>
using namespace std;
int main ()
{
    cout<< "special characters character";
    Char ch= ' \ r ';      /  R indicates carriage return, but it is not equal to wrapping. * *
    cout<<ch<< "special purpose";
    return 0;
}

Run Result:

Why is this result entered?

A: This question goes back to the typewriter era, when the typewriter had to jump to the next line for entry,

The first step is to return to the beginning of the line, and then push the paper up one line, so the return function simply returns to the beginning of the line.

Author: cnblogs Nebula

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.