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
|
// CS 2308.0001
// 23 September 2008
// prog3.cpp
// coded by Christy Sylvest
//This Program shows the donations made to
//the United Cause by the employees of CK Graphics, Inc.
//It displays the donations in order from lowest
//to highest ans in the original order they were received.
#include<iostream>
#include<fstream>
#include "arrBubbleSort.h"
#include "showArray.h"
#include "showArrPtr.h"
using namespace std;
int main()
{
ofstream outFile;
outFile.open("outFile.txt");
const int NUM_DONATIONS = 15; //Number of Donations
int donations [NUM_DONATIONS] = {5, 100, 5, 25, 10, 5, 25, 5, 5, 100, 10, 15, 10, 5, 10};
int *arrPtr[NUM_DONATIONS];
for (int count = 0; count < NUM_DONATIONS; count++)
arrPtr[count] = &donations[count];
arrBubbleSort(arrPtr, NUM_DONATIONS);
outFile << "The donations, sorted in ascending order are: \n";
showArrPtr (arrPtr, NUM_DONATIONS, outFile);
outFile << "The donations, in their original order are: \n";
showArray (donations, NUM_DONATIONS, outFile);
return 0;
}
|