예제 #1
0
파일: main.cpp 프로젝트: argets08/School
int main(int argc, char** argv) {
    Numbers numList;
    cout << "Reading in sorted file" << endl;
    numList.readFile("sorted.txt");
    cout << "The total number of values in the Sorted array are " << numList.getCount() << endl;
    cout << "The 23rd value in the sorted file is" << numList.getValue(23) << endl;
    cout << "The biggest Value in the Sorted file is " << numList.findMax() << endl;
    cout << "The smallest number in the Sorted file is " << numList.findMin() << endl;
    cout << "The mean of numers in the Sorted array is " << numList.findMean() << endl;
    cout << "-----------------------------------------------" << endl;
    cout << "Reading in Un-sorted file" << endl;

    // cout << "TEST TEST TEST TEST" << endl;            //debug
    //  numList.Print();                             //debug

    numList.readFile("unsorted.txt");
    cout << "The total number of values in the  Unsorted array are " << numList.getCount() << endl;
    cout << "The 23rd value in the Unsorted file is" << numList.getValue(23) << endl;
    cout << "The biggest Value in the Unsorted file is " << numList.findMax() << endl;
    cout << "The smallest number in the Unsorted file is " << numList.findMin() << endl;
    cout << "The mean of numers in the Unsorted array is " << numList.findMean() << endl;
    cout << "-----------------------------------------------" << endl;

    // cout << "TEST TEST TEST TEST" << endl;            //debug
    //  numList.Print();                             //debug


    cout << " Homework 2.2 begins here" << endl;
    //hw 2.2
    numList.readFile("unsorted.txt");
    int checkEntry; //for dynamic use       //used 20899 as a test case
    cout << "Please enter number you wish to check for multiple occurances " << endl;
    cin >> checkEntry; //user entry
    cout << "number of times checkEntry comes up in unsorted file = " << numList.countValue(checkEntry) << endl;
    //cout << "number of times checkEntry comes up in sorted file = " << numList.countValue(20899) << endl;


    cout << "the index at which checkEntry comes up in the unSorted file = " << numList.lookupValue(checkEntry, 0, numList.getCount()) << endl;
    //cout << "the index at which 20899 comes up in the Sorted file = " << numList.lookupValue(20899, 0, numList.getCount()) << endl;


    return (EXIT_SUCCESS);
}