THIS IS THE CLASS TEMPLATE BELOW:
#include <iostream> #include <vector> using namespace std; //Complete the code for NumberClass class here int main() { NumberClass<int> myNum({99,34,12,44,77,2,37,4,54,68, 44, 102, 5, 42}); cout << "Print the elements in the vector" << endl; myNum.printNumber(); cout << endl; cout << "Is 77 in the vector? : " << boolalpha<<myNum.isExist(77) << endl; cout << "Is 100 in the vector? : " << boolalpha<<myNum.isExist(100) << endl; cout << "The max value of the vector is " << myNum.findMax() <<endl; cout << "The min value of the vector is " << myNum.findMin() <<endl; cout << "The average value of the vector is " << myNum.findAvg() <<endl; cout << "The number of even numbers in the vector is " << myNum.countEven() <<endl; myNum.replaceNumber(100,5); cout << "Print the vector after one number is replaced." << endl; myNum.printNumber(); cout << endl; NumberClass<double> myDouble({100.3,32.78,12.12, 55.44}); cout << "Print the elements in the vector" << endl; myDouble.printNumber(); return 0; }
Get Free Quote!
334 Experts Online