diff --git a/Data.cpp b/Data.cpp new file mode 100644 index 0000000..3ea685f --- /dev/null +++ b/Data.cpp @@ -0,0 +1,34 @@ +#include +#include "Data.h" + +using namespace std; + + +Data::Data() +{ +x=0; +y=0.0; +} + +Data::Data(int a, float b) +{ +x=a; +y=b; +} +float Data::getY() +{ +return y; +} +int Data::getX() +{ +return x; +} +void Data::setX(int a) +{ +x=a; +} +void Data::setY(float a) +{ +y=a; +} + diff --git a/Data.h b/Data.h new file mode 100644 index 0000000..3d8b797 --- /dev/null +++ b/Data.h @@ -0,0 +1,28 @@ +#ifndef DATA_H +#define DATA_H + +#include +#include + +using namespace std; + +class Data +{ +private: + +int x; +float y; + +public: + +Data(); +Data(int a, float b); +float getY(); +int getX(); +void setX(int a); +void setY(float a); + + +}; + +#endif diff --git a/hellogit,out b/hellogit,out new file mode 100755 index 0000000..078dfc2 Binary files /dev/null and b/hellogit,out differ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..8ed806b --- /dev/null +++ b/main.cpp @@ -0,0 +1,113 @@ +#include +#include +#include "Data.h" + +using namespace std; + +void print (auto A) +{ + for (auto a : A) + cout << a << " "; + + cout< 0 and D[j] < D[j-1]) + { + swap (D[j], D[j-1]); + j--; + } + print(D); + + } +} + +void insertionSortClass (auto& D) +{ + for (int i=1; i < D.size(); i++) + { + int j=i; + while (j > 0 and D[j].getX() < D[j-1].getX()) + { + swap (D[j], D[j-1]); + j--; + } + printClass(D); + + } +} + +int main() + + +{ + + vector v1; + vector v2={22,8,7,9,45}; + v1.push_back(17); + + vector w = {7, 6, 5, 4, 3, 2}; + + insertionSort(w); + + for (auto i:w) + { + cout << i << " "; + } + + + cout < v; + v.push_back( {7,21.01} ); + Data d; + v.push_back(d); + d.setX(6); + d.setY(12.10); + v.push_back(d); + d.setX(5); + d.setY(6.12); + v.push_back(d); + + cout <