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

📄 13v.cpp

📁 《C/C++程序设计导论(第二版)》一书的程序源文件
💻 CPP
字号:
// Perform a binary search of the names in file "namelist.txt"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;const int NUMNAMES = 10;
int Find (String, String[], int, int);
void main()
{	string name_array[NUMNAMES], name;
	ifstream infile ("namelist.txt", ios::in);
	int n;
	for (n=0; n<NUMNAMES; n++)
		infile >> name_array[n];				// read in names
	cout << " enter name to be found: ";
	cin >> name;					// get name for search..
	cout << name << " found at index "
		<< Find (name, name_array, 0, NUMNAMES-1);
}

⌨️ 快捷键说明

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