I am new at this - a project for my Intro to Object Oriented Programming class. Any help would be so appreciated. So I started by creating the class BubbleSort and the member functions. sort is supposed to take an array of integers of length 10 and print them from greatest to smallest. I included a link to a bit of code my teacher gave us to help start us off with the assignment. Sorry if this is too vague, I am sure there are problems with my overall design. Thank you for your time. Also I get the following errors in Xcode Expected '(' for function-style cast or type construction and Unused variable 'nArray' enter image description here
#include <iostream>
using namespace std;
// class declaration
class BubbleSort
{
public:
BubbleSort(); //initialize nArray to contain set of unsorted numbers
void sort(int nArray []); //sort array
private:
int nArray[]; //stores the unsorted numbers
};
BubbleSort :: BubbleSort() { //default constructor
int nArray [] = {256, 734, 201, 3, 123, 40, 99, 257, 7, 609};
}
void BubbleSort :: sort (int nArray []) { //prints the highest number
int highest = nArray[0]; //highest value of the array
int index = 0; //index of the highest value of the arrray
int count = 0; //counts the time you check the array
while (count != 10) {
for (int i = 0; i < 10; i++) {
if (nArray[i] > highest) {
highest = nArray[i];
index = i;
}
}
cout << "The highest value at that moment: " << highest << endl;
nArray[index] = 0;
highest = 0;
count ++;
}
}
int main() {
BubbleSort myArray; //create object
myArray.sort(int myArray[])
return 0;
}