36 lines
733 B
C++
36 lines
733 B
C++
#include <algorithm>
|
|
#include <vector>
|
|
#include <iostream>
|
|
#include <list>
|
|
#include "Test.h"
|
|
|
|
int main() {
|
|
Derived * derived = new Derived();
|
|
|
|
bar(derived);
|
|
|
|
delete derived;
|
|
|
|
std::vector<int> v(100);
|
|
|
|
for (int j = 0; j < 10; ++j) {
|
|
v[j*j] = j;
|
|
}
|
|
v.push_back(17);
|
|
printVector(v);
|
|
|
|
std::sort(v.begin(), v.end());
|
|
printVector(v);
|
|
|
|
std::transform(v.begin(), v.end(), v.begin(), [] (int i) {return i * 10;});
|
|
printVector(v);
|
|
}
|
|
|
|
void printVector(std::vector<int> vector) {
|
|
if(!vector.empty()) {
|
|
std::cout << "Neuer Vector" << std::endl;
|
|
for(int i = 0; i < vector.size(); i++) {
|
|
std::cout <<"i=" << i << "|" << vector[i] << std::endl;
|
|
}
|
|
}
|
|
} |