Input and Output spaces in CIN

Source: Internet
Author: User

Author: horsetail

Source:Http://www.cppblog.com/horsetail/archive/2007/10/18/17814.html

Because STD: CIN cannot directly accept spaces (spaces are used as the input flag), we need to use a member function STD: CIN in the CIN object. get () accepts a single character. STD: cout. put () member functions are output directly. as follows:

# Include <iostream>

Using namespace STD;

Int main ()
{
Char C;

While (CIN. Get () // accept a single character (including spaces)
{
Cout. Put (); tune // output a single character!
}

Return 1;
}

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.