int main(){
    Median mm;
    int A[] = {3, 6, 2, 7, 3, 1, 10, 9, 17};
    int n = 9;
    for(int i = 0; i < n; ++i){
        mm.insert(A[i]);
    }
    mm.get_size();
    cout << mm.get_median() << endl;
    
}
示例#2
0
int main(void)
{
   Median m;
   cout << "Please enter values " <<endl;
   while (!cin.eof()) {
      int value;
      cin >> value;
      m.insert(value);
      cout << "New median is " << m.getMedian() << endl;
   }
   return 0;
}
示例#3
0
int main(){
	srand((unsigned)time(NULL));
	Median md;
	vector<int> vi;
	int num = rand() % 30;
	for(int i=0; i<num; i++){
		int data = rand() % 100;
		vi.push_back(data);
		md.insert(data);
	}
	sort(vi.begin(), vi.end());
	for(int i=0; i<num; i++){
		cout<<vi.at(i)<<" ";
	}
	cout<<endl<<md.getValue()<<endl;
	return 0;
}