How do I enter the terminator EOF on windows?

Source: Internet
Author: User

From: http://zhidao.baidu.com/question/293245134.html? Fr = qrl & cid = 93 & Index = 3

On Windows, generally, the input of the simulated EOF is Ctrl + Z at the beginning of a new line. In UNIX, enter Ctrl + D at the beginning of a new line.
 
Attached:
// Three sentences are used to input words on the screen, sort words in alphabetical order, remove duplicate words, and output to the screen. Vector <string> V1 (istream_iterator <string> (CIN), (istream_iterator <string> (), sort (v1.begin (), v1.end ()); // cout <"\ n out: \ n"; unique_copy (v1.begin (), v1.end (), ostream_iterator <string> (cout, ""); Explanation from:
http://blog.csdn.net/sandy_zc_1/article/details/6529304
 
With STL implementation, there are exactly three lines of code. To explain a little: the first sentence defines a vector V1 and passes in two input stream iterators In the constructor. These two iterators constitute a range that represents all input words, until the input ends (EOF ). In this way, V1 fills up all input words during creation. Second, use sort to sort the elements in the vector. Yes, you do not need to write complex string comparison functions. Strings contain operator <definitions. Sort only requires a smaller number to operate. After sorting, all words are sorted in alphabetical order. Third, use unique_copy to copy data in V1 to the target range. The difference between unique_copy and copy is that it can remove N consecutive identical elements, leaving only one element to implement unique. The starting point of the target range of this copy is the stream iterator. This is the output stream iterator, which outputs the data from the algorithm to the cout, so it is displayed on the screen. It's amazing. It's powerful. I think it is quite good to use this example as the end of the introduction of the iterator adapter.

Related Article

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.