c_cpp don_not_know_why.cpp

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp don_not_know_why.cpp相关的知识,希望对你有一定的参考价值。

// Every newline will find_first_of the inputting value, if can find, return pos, otherwise, continue to input.
// It can use for judging any one of the inputting values in the each line whether in the specified set.
// But I don't know it is why.
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <iterator>

using namespace std;

int main() {
	vector<int> vec = { 32 };

  	// if one of inputting the value is in the vec, newline action will output the value, 
	// then over the procedure.
  	// However, if no one value is in the vec, I can continue to input.
	auto pos = find_first_of( istream_iterator<int>( cin ), istream_iterator<int>(),
							   vec.begin(), vec.end());
	if (pos != istream_iterator<int>()) {
		cout << *pos << endl;
	}

	system( "pause" );
	return 0;
}

以上是关于c_cpp don_not_know_why.cpp的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp 127.单词阶梯

c_cpp MOFSET

c_cpp MOFSET

c_cpp 31.下一个排列

c_cpp string→char *

c_cpp 54.螺旋矩阵