-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rau maria #87
base: Rau_Maria
Are you sure you want to change the base?
Rau maria #87
Changes from 18 commits
910cac6
fd588c5
25229fe
83670f0
8350631
4ae3de1
25c44d0
e80ca67
d4af085
0cf9824
9343297
e8fe838
46bd3c9
9e53929
a512b46
b1634fe
ab619b5
b1fb0fb
6502cfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
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; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
|
||
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; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
#include<windows.h> | ||
|
||
using namespace std; | ||
float prod(int); | ||
float divis(int); | ||
|
||
|
||
int main() | ||
{ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. зачем эта скобка? |
||
SetConsoleOutput(CP_UTF8) | ||
int a, b, num; | ||
cout » "enter first number" | ||
cin » a « endl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Запись совсем не смущает? Нет ; в 15 строке, в 16 вообще ужас творится)) |
||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. сразу возвращаем 0, без каких-либо операций?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
нужно было вызвать деструктор,сейчас исправлю |
||
} | ||
return(a / b); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
#include<windows.h> | ||
|
||
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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
|
||
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); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <iostream> | ||
|
||
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); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <iostream> | ||
#include <ctime> | ||
|
||
using namespace std; | ||
|
||
|
||
int main() | ||
{ | ||
srand(time(NULL)); | ||
|
||
int n; | ||
int min = 888; | ||
|
||
cin >> n; | ||
int *a = new int[n]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Если выделяете динамически память, то в конце ее нужно освобождать There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <iostream> | ||
#include <ctime> | ||
|
||
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]; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вы вообще код запускали? У Вас каждая функция без фигурных скобок |
||
int main() | ||
{ | ||
srand(time(NULL)); | ||
|
||
int n; | ||
int min = 888; | ||
|
||
cin >> n; | ||
int *a = new int[n]; | ||
|
||
cout << endl; | ||
cout << min; | ||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include <iostream> | ||
#include <ctime> | ||
|
||
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); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Тут тоже память не освобождается |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
|
||
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); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
откуда bx и ax появились?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a и b это коэффициенты при х знака умножения не хватает