⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch12.1.02.c

📁 C++ Primer(第三版)的随书源代码
💻 C
字号:
#include <algorithm>
#include <vector>
#include <iostream.h>
// #include <iostream>

/**
 **
 stanl@john:d.12 315 : a.out
 enter search value: 218
 The value 218 is not present

 stanl@john:d.12 316 : a.out
 enter search value: 210
 The value 210 is present
 **
 **/

int main()
{
  	int search_value;
  	int ia[ 6 ] = { 27, 210, 12, 47, 109, 83 };
  	vector<int> vec( ia, ia+6 );

  	cout << "enter search value: ";
  	cin >> search_value;

  	vector<int>::iterator presult;
  	presult = find( vec.begin(), vec.end(), search_value );

  	cout << "The value " << search_value
     		<< (presult == vec.end()
      			? " is not present" : " is present" )
       		<< endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -