diff --git "a/\320\267\320\260\320\260\320\264\320\260\320\275\320\270\320\2652.cpp" "b/\320\267\320\260\320\260\320\264\320\260\320\275\320\270\320\2652.cpp" new file mode 100644 index 0000000..01de1e2 --- /dev/null +++ "b/\320\267\320\260\320\260\320\264\320\260\320\275\320\270\320\2652.cpp" @@ -0,0 +1,46 @@ +#include +#include + using namespace std; + + float VectorLength(int x, int y, int z) + { + return sqrt(x * x + y * y + z * z); + } + void SingleVector(int x, int y, int z, float length) + { + cout << x / length << " " << y / length << " " << z / length << endl; + + } + float ScalarProduct(int x, int a, int y, int b, int z, int c) + { + return x * a + y * b + z * c; + } + void VectorProduct(int x, int a, int y, int b, int z, int c) + { + cout << y * c - z * b << " " << -1 * (x * c - z * a) << " " << x * b - y * a << endl; + } + int main(int args, char* argv[]) + { + int x = 1; + int y = 5; + int z = 3; + int a, b, c; + + cout << "1.1" << endl; + float length = VectorLength(x, y, z); + + cout << "Vector Length = " << length << endl; + + cout << "1.3" << endl; + + cin >> a >> b >> c; + + cout << ScalarProduct(x, a, y, b, z, c) << endl; + + cout << "1.4" << endl; + + VectorProduct(x, y, z, a, b, c); + + + return 0; + }; \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\265 4.1 \320\277\320\265\321\200\320\265\320\264\320\265\320\273\320\260\320\275\320\276.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\265 4.1 \320\277\320\265\321\200\320\265\320\264\320\265\320\273\320\260\320\275\320\276.cpp" new file mode 100644 index 0000000..62582c8 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\265 4.1 \320\277\320\265\321\200\320\265\320\264\320\265\320\273\320\260\320\275\320\276.cpp" @@ -0,0 +1,43 @@ +#include +#include +#include + +using namespace std; + +float prod(int a, int b); +float divis(int a, int b); + +int main() +{ + SetConsoleOutputCP(CP_UTF8); + int a, b, num; + cout « "enter first number" « endl; + cin » a; + cout « "enter second number" « endl; + cin » b; + cout « "enter operation number" « endl; + cin » num; + switch (num) { +case 1: + cout « prod(a, b) « endl; + break; +case 2: + cout « divis(a, b) « endl; + break; +default: + cout « "1 -multiplication, 2 - division" « endl; +break; +} + +return 0; + +} + +float prod(int a, int b) +{ +return a * b; +} +float divis(int a, int b) +{ +return a / b; +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2651.17.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2651.17.cpp" new file mode 100644 index 0000000..3abb964 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2651.17.cpp" @@ -0,0 +1,25 @@ +#include +#include + +int main(int args, char* argv[]) { + using namespace std; + + const float a = 0.1; + const float b = 0.5; + + float x = 0.15; + float xk = 1.37; + float dx = 0.25; + + for (; x < xk; x += dx) { + cout << ((a+(tg(bx)*tg(bx)))/(b+(ctg(ax)*ctg(ax))))) << endl; + }; + + float xs[5] = { 1.9, 2.15, 2.34, 2.73, 3.16 }; + + for (auto x : xs) { + cout << ((a+(tg(bx)*tg(bx)))/(b+(ctg(ax)*ctg(ax))))) << endl; + }; + + return 0; +}; diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2654.1.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2654.1.cpp" new file mode 100644 index 0000000..7832d97 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2654.1.cpp" @@ -0,0 +1,45 @@ +#include +#include +#include + +using namespace std; +float prod(int); +float divis(int); + + +int main() +{ + { + SetConsoleOutput(CP_UTF8) + int a, b, num; + cout » "enter first number" + cin » a « endl; + cout » "enter second number" + cin » b « endl; + cout » "enter operation number" + cin » num « endl; + switch (num) : + case 1: + cout « prod(a, b) « endl; + break; + case 2: + cout « divis(a, b) « endl; + break; + default: + cout « "1 -multiplication, 2 - division" « endl; + break; + + return 0; + + } + + float prod(int a, int b) + { + return a * b; + } + float divis(int a, int b) + { + return 0; + } + return(a / b); +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2654.4.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2654.4.cpp" new file mode 100644 index 0000000..38ffb57 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2654.4.cpp" @@ -0,0 +1,31 @@ +#include +#include +#include + +using namespace std; + +int main() +{ + SetConsoleCP(CP_UTF8); + SetConsoleOutputCP(CP_UTF8); + int a; + int b; + int sum = 0; + cout « "введите начало"; + cin » a; + cout « "конец"; + cin » b; + + while (a <= b) + { + //if (a % 2 == 0) + //{ + // sum += a; + // + //} + sum += (a % 2 == 0) ? a : 0; + a += 1; + } + cout « "сумма=" « sum « endl; + return 0; +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.1.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.1.cpp" new file mode 100644 index 0000000..2f016af --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.1.cpp" @@ -0,0 +1,19 @@ +#include + +using namespace std; + +void per(int *x, int *y, int *a) +{ + cout << *x << endl; + cout << *y << endl; + cout << *a; + +} + +int main() +{ + int x = 8, y = 30, a = 0; + + per(&x, &y, &a); + +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.2.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.2.cpp" new file mode 100644 index 0000000..5694c4e --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.2.cpp" @@ -0,0 +1,24 @@ +#include + +using namespace std; + +void foo(float *x, float *y) +{ + float *t; + t = x; + x = y; + y = t; + + cout << *x << endl; + cout<< *y; + +} + +int main() +{ + float x = 34.5; + float y = 69.7; + + foo(&x, &y); + +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.3.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.3.cpp" new file mode 100644 index 0000000..a8e47fe --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.3.cpp" @@ -0,0 +1,35 @@ +#include +#include + +using namespace std; + + +int main() +{ + srand(time(NULL)); + + int n; + int min = 888; + + cin >> n; + int *a = new int[n]; + +for (int i = 0; i < n; i++) { + + a[i] = rand() % 100; +} + +for (int i = 0; i < n; i++) +{ + cout << a[i] << "\t"; +} +for (int i = 0; i < n; i++) { + if (a[i] < min) { + min = a[i]; + } +} + cout << endl; + cout << min; + + return 0; +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.4.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.4.cpp" new file mode 100644 index 0000000..e3e73ce --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.4.cpp" @@ -0,0 +1,37 @@ +#include +#include + +using namespace std; + +void start(int *a, int n) +for (int i = 0; i < n; i++) { + + a[i] = rand() % 100; +} + +void display( int *a, int n) +for (int i = 0; i < n; i++) +{ + cout << a[i] << "\t"; +} + void tytmin( int *a, int n, int min) +for (int i = 0; i < n; i++) { + if (a[i] < min) { + min = a[i]; + } +} +int main() +{ + srand(time(NULL)); + + int n; + int min = 888; + + cin >> n; + int *a = new int[n]; + + cout << endl; + cout << min; + + return 0; +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.5.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.5.cpp" new file mode 100644 index 0000000..c2ed3e3 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2655.5.cpp" @@ -0,0 +1,79 @@ +#include +#include + +using namespace std; + +void FindMin(int **masiv, int row, int col, int *masivaa) +{ + int min = 965; + + for (int i = 0; i < row; i++) + { + min = 965; + + for (int j = 0; j < col; j++) + { + if (masiv[i][j] < min) + { + min = masiv[i][j]; + } + + } + masivaa[i] = min; + } + + cout << "Minimum = { "; + + for (int i = 0; i < row; i++) + { + cout << masivaa[i] << " "; + } + + cout << "}" << endl; + +} + +int main() +{ + srand(time(NULL)); + + int row; + int col; + + cin >> row; + cin >> col; + cout << endl; + + + int** masiv = new int* [row]; + for (int i = 0; i < row; i++) + { + masiv[i] = new int[col]; + } + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < col; j++) + { + masiv[i][j] = rand() % 100; + } + + } + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < col; j++) + { + cout << masiv[i][j] << "\t"; + } + + cout << endl; + } + cout << endl; + + + int *masivaa = new int[row]; + + FindMin(masiv, row, col, masivaa); + +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.1.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.1.cpp" new file mode 100644 index 0000000..eeaa74e --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.1.cpp" @@ -0,0 +1,23 @@ +#include +#include + +using namespace std; + +void function(int f[]) +{ + for (int n = 3; n < 16; n++) + { + f[n] = f[n - 1] + f[n - 2] + f[n - 3]; + cout << f[n]; + } +} + +int main() +{ + int f[15]; + f[0] = 0; + f[1] = 3; + f[2] = 5; + function(f); + +} diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.2.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.2.cpp" new file mode 100644 index 0000000..6333942 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.2.cpp" @@ -0,0 +1,45 @@ +#include +#include + +using namespace std; + +void translation(int a) +{ + int binar = 0; + int octal = 0; + int hex = 0; + int v = a, s = a; + + for (int i = 0; a > 0; i++) + { + binar += (a % 2) * pow(10.0, i); + a/= 2; + } + + for (int i = 0; v > 0; i++) + { + octal += (v % 8) * pow(10.0, i); + v/= 8; + } + + for (int i = 0; s > 0; i++) + { + hex += (s % 16) * pow(10.0, i); + s/= 16; + } + cout << binar << endl; + cout << octal << endl; + cout << hex << endl; +} + +int main() +{ + int a; + cin >> a; + while (a < 0 || a > 325) + { + cin >> a; + } + + translation(a); +} diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.3.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.3.cpp" new file mode 100644 index 0000000..0aa6694 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.3.cpp" @@ -0,0 +1,21 @@ +#include +#include + +using namespace std; + +int main() +{ + int x=0, y=0; + cin >> x >> y; //вводятся числа с общим делителем + + if (x > y) + { + x = x % y; + } + else { + y = y % x; + } + + while ((x != 0) && (y != 0)); + cout << (x + y); +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.4.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.4.cpp" new file mode 100644 index 0000000..4d4fa14 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2656.4.cpp" @@ -0,0 +1,23 @@ +#include +#include + +using namespace std; + +int main() +{ + int x, y; + cin >> x >> y; //то же самое что и в предыдущем + int a = x; + int c = y; + if (x > y) + { + x = x % y; + } + else { + y = y % x; + + } + + while ((x != 0) && (y != 0)); + cout << a / (x + y) * c; +} \ No newline at end of file diff --git "a/\320\267\320\260\320\264\320\260\320\275\320\270\320\2657.2.cpp" "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2657.2.cpp" new file mode 100644 index 0000000..2686141 --- /dev/null +++ "b/\320\267\320\260\320\264\320\260\320\275\320\270\320\2657.2.cpp" @@ -0,0 +1,71 @@ +#include + +using namespace std; + +void draw(int hight, char sym, int index1, int index2, char space) { + + while (index1 <= hight) + { + + cout << string(index1, sym) << endl; + + index1++; + + } + + cout << endl; + + while (index2 > 0) + { + + cout << string(index2, sym) << endl; + + index2--; + + } + + for(int i = 0; i <= hight; i++) + { + cout<< string(hight-i, space); + + cout<< string(i, sym) << endl; + + } + + cout << endl; + + for(int i = hight; i > 0; i--) + { + + cout<< string(hight-i, space); + + cout<< string(i, sym) << endl; + + } + +} + +int main() + { + + int hight, index1, index2; + + char sym; + + char space = ' '; + + cout << "Enter height of triangle = "; + + cin >> hight; + + cout << "Enter sym of triangle = "; + + cin >> sym; + + index1=0; + + index2=hight; + + draw(hight, sym, index1, index2, space); + +} \ No newline at end of file