int main(int argc, const char * argv[]) { ArrayVector<int> my_vector; for (int i = 0; i < 15; i++) { my_vector.insertAtRank(i, i * 2 + 2); std::cout << "in slot " << i << " is the number " << my_vector.elemAtRank(i) << "\n"; }; my_vector.removeAtRank(10); my_vector.removeAtRank(1); my_vector.removeAtRank(12); std::cout << "show vector after some removals\n"; for (int i = 0; i < 12; i++) { std::cout << "in slot " << i << " is the number " << my_vector.elemAtRank(i) << "\n"; } // 2) Own example here std::cout << std::endl << "2) My own example ------------" << std::endl; ArrayVector<float> other; for (int i = 0; i < 12; i++) { other.insertAtRank(i, i * PI); std::cout << "In slot " << i << " is the number " << other.elemAtRank(i) << std::endl; } std::cout << std::endl << "--- Size of vector: " << other.size() << " ---" << std::endl; while (!other.isEmpty()) { other.removeAtRank(0); } const char* res = other.isEmpty() ? "Yes" : "No"; std::cout << "--- Is vector now empty? " << res << std::endl; return 0; }
int main (int argc, const char * argv[]) { ArrayVector<int> my_vector; for (int i=0; i<15; i++) { my_vector.insertAtRank(i, i*2+2); std::cout<<"in slot " << i << " is the number " << my_vector.elemAtRank(i) << "\n"; }; my_vector.removeAtRank(10); my_vector.removeAtRank(1); my_vector.removeAtRank(12); std::cout <<"show vector after some removals\n"; for (int i=0; i<12; i++) { std::cout<<"in slot " << i << " is the number " << my_vector.elemAtRank(i) << "\n"; } //own Example here! ArrayVector<double> example; std::cout << "own example\n"; for (int i = 0; i < 100; i++) { example.insertAtRank(i, (double)i/32.1); } for (int i = 0; i < 100; i += 3) { example.removeAtRank(i); } for (int i = 0; i < 65; i++) { std::cout<<"in slot " << i << " is the number " << example.elemAtRank(i) << "\n"; } return 0; }