1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
string payrate, name, hours, wages;
string inputfile, outputfile;
int empID;
cout << "Enter the name of the input file. ";
cin >> inputfile;
cout << "Enter the name of the output file. ";
cin >> outputfile;
// open the input and output files
cout << "Enter an employee number for your search. " << endl;
cin >> empID;
while (empID <= 0)
{ // Not valid
cout << " Sorry, The number you entered is not valid " << endl;
cin >> empID;
}
// Initialize hours, payrate and wages
cout << "Employee " << empID << " worked " << hours << " hours " << " at " << payrate << " per hour and earned " << wages << endl;
cout << "Processing completed. " << endl;
}
int searchList(const int list[], int numElems, int value)
{
int index = 0;
int position = 1;
bool found = false;
while (index < numElems && !found)
{
if (list[index] == value)
{
found = true;
position = index;
}
index++;
}
return position;
}
int binarySearch(const int array[], int size, int value);
{
int first = 0,
last = size - 1;
middle,
position = -1,
bool found = false;
while (!found && first <= last)
{
middle = (first + last) / 2)
if (array[middle] == value)
void selectionSort(int array[], int size)
{
int startScan, minIndex, minValue;
for (startScarn = 0; startScan < (size - 1; startScarn++)
{
minIndex = startScan;
minValue = array[startScan];
for (int index = startScan + 1; index < size; index++)
|