ch12.1.03.c
来自「C++ Primer(第三版)的随书源代码」· C语言 代码 · 共 35 行
C
35 行
#include <algorithm>
#include <list>
#include <iostream.h>
// #include <iostream>
/**
**
stanl@john:d.12 320 : a.out
enter search value: 42
The value 42 is not present
stanl@john:d.12 321 : a.out
enter search value: 83
The value 83 is present
**
**/
int main()
{
int search_value;
int ia[ 6 ] = { 27, 210, 12, 47, 109, 83 };
list<int> ilist( ia, ia+6 );
cout << "enter search value: ";
cin >> search_value;
list<int>::iterator presult;
presult = find( ilist.begin(), ilist.end(), search_value );
cout << "The value " << search_value
<< (presult == ilist.end()
? " is not present" : " is present" )
<< endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?