init commit

This commit is contained in:
2025-04-13 21:48:15 +03:00
commit 23255e9121
192 changed files with 12200 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
class C {
public:
static const char c;
static void f() {};
};
// const char C::c = '+';
// int main() {
// C ob;
// C::f();
// return 0;
// }
+42
View File
@@ -0,0 +1,42 @@
class C
{
int x;
public:
C() { x = 0; }
C(double tmp) { x = 0; }
C(int tmp) { x = tmp; }
C(const C o1, const C o2) { x = o1.x + o2.x; }
C(const C* o) {}
friend C
operator+(const C& o1, const C& o2) {
return C(o1.x + o2.x);
}
C
operator++() {
return C(++x);
}
int operator~() const { return ~x; }
int
operator*(const C* obj2) {
return 0;
}
};
/*
C
func1(const C& v1, int v2) {
return C(v2 + v1, ~v1);
}
void
func2(const C* p1, double p2) {
C v1 = p2;
C v2[2][2];
C v3 = func1(func1(func1(&p1[3], p2), ~p1[2]), ++v1 * v2[1]);
}
int
main() {
return 0;
}
*/
+28
View File
@@ -0,0 +1,28 @@
#include <string>
using namespace std;
class BinaryNumber
{
string str;
public:
BinaryNumber(const string& s = "0") {
str = s;
}
operator string () const {
return str;
}
const BinaryNumber& operator++() {
std::string::iterator i = str.end() - 1;
while (*i == '1' && i != str.begin()) {
*i = '0';
--i;
}
if (i == str.begin()) {
str.insert(str.begin(), '1');
} else {
*i = '1';
}
return *this;
}
};
+56
View File
@@ -0,0 +1,56 @@
#include <iostream>
using namespace std;
class Row
{
public:
int* const cells = new int[3];
int*
begin() const {
return cells;
}
int*
end() const {
return cells + 3;
}
int& operator[](int ind) const {
return cells[ind];
}
};
class Matrix
{
public:
const Row r[3];
const Row*
begin() const {
return r;
}
const Row*
end() const {
return r + 3;
}
int&
operator[](int ind1, int ind2) {
return r[ind1][ind2];
}
};
// int
// main() {
// Matrix m;
// m[1, 1] = 5;
// for (const auto& row : m) {
// for (auto cell : row) {
// cout << cell << " ";
// }
// cout << "\n";
// }
// }