📄 13v.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 + -