-
Notifications
You must be signed in to change notification settings - Fork 21
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
фигуры #94
Open
svvan45
wants to merge
15
commits into
Nastasia8:master
Choose a base branch
from
svvan45:Lebedev_Evgeniy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
фигуры #94
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7e516e6
123
svvan45 b61fe1b
1 zad
svvan45 e694095
Dinamicheskiy mass
svvan45 dffe25b
Задание с файлами
svvan45 24fc3b5
Add files via upload
svvan45 a058eb2
Add files via upload
svvan45 524320d
Create folder.gitkeep
svvan45 53f57a8
Python
svvan45 9617189
фильм
svvan45 2367aed
студент
svvan45 4ac0436
Create матник.cpp
svvan45 e5523f6
Массив
svvan45 6d08293
Фигуры символами
svvan45 7cf454a
Add files via upload
svvan45 efec5d3
переделал, сделал классы
svvan45 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include "film.h" | ||
using namespace std; | ||
|
||
|
||
|
||
int film::set_point(int *arr) | ||
{ | ||
for ( int i = 0; i < 3; i++){ | ||
int a; | ||
cin >> a; | ||
arr[i] = a; | ||
} | ||
return *arr; | ||
} | ||
float film::sr_point(int *arr) | ||
{ | ||
int sum=0; | ||
for (int i = 0; i < 3; i++) | ||
{ | ||
|
||
sum += arr[i]; | ||
|
||
} | ||
sr = sum / 3; | ||
return sr; | ||
} | ||
void film::set_name(){ | ||
cin >> name; | ||
} | ||
void film::set_year(){ | ||
cin >> year; | ||
} | ||
void film::get(){ | ||
cout << name << endl; | ||
cout << year << endl; | ||
cout << sr << endl; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <iostream> | ||
#include <string> | ||
using namespace std; | ||
|
||
class film { | ||
private: | ||
string name; | ||
int year; | ||
float sr; | ||
public: | ||
int set_point (int *arr); | ||
float sr_point(int *arr); | ||
void set_name (); | ||
void set_year(); | ||
void get (); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include "film.h" | ||
using namespace std; | ||
|
||
int main(){ | ||
int *arr = new int [3]; | ||
float arr2[3]; | ||
cout << "Write name, year, points: " << endl; | ||
film f1; | ||
f1.set_name(); | ||
f1.set_year(); | ||
f1.set_point(arr); | ||
arr2[0] = f1.sr_point(arr); | ||
cout << "Write name, year, points: " << endl; | ||
film f2; | ||
f2.set_name(); | ||
f2.set_year(); | ||
f2.set_point(arr); | ||
arr2[1] = f2.sr_point(arr); | ||
cout << "Write name, year, points: " << endl; | ||
film f3; | ||
f3.set_name(); | ||
f3.set_year(); | ||
f3.set_point(arr); | ||
arr2[2] = f3.sr_point(arr); | ||
|
||
float max = arr2[0]; | ||
int t = 0; | ||
for (int i = 1;i < 3; i++ ){ | ||
if (max < arr2[i]) | ||
{ | ||
max = arr2[i]; | ||
t = i; | ||
} | ||
} | ||
switch (t) | ||
{ | ||
case 0: | ||
f1.get(); | ||
break; | ||
case 1: | ||
f2.get(); | ||
break; | ||
case 2: | ||
f3.get(); | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
using namespace std; | ||
|
||
float ed_v(float dl_v, int a); // Единичный вектор | ||
|
||
int main(){ | ||
float ed_x, ed_y, ed_z; | ||
int x = 1; | ||
int y = 5; | ||
int z = 3; | ||
float dl_v = sqrt(x*x+y*y+z*z); // Длина вектора | ||
ed_x = ed_v(dl_v,x); | ||
ed_y = ed_v(dl_v,y); | ||
ed_z = ed_v(dl_v,z); | ||
cout << "Koordinati vtorogo vektora" << endl; | ||
int x1, y1, z1; | ||
cin >> x1; | ||
cin >> y1; | ||
cin >> z1; | ||
int skal_proizved = x*x1+y*y1+z*z1; | ||
int v_pr_i, v_pr_j, v_pr_k; // Векторное произведение | ||
cout << "Skalyarnoe proizvedenie= " << skal_proizved << "\tEdinichiniy vektor: (" << ed_x << ";" << ed_y << ";" << ed_z << ")" << endl; | ||
v_pr_i = y*z1 - y1*z; | ||
v_pr_j = x1*z - x*z1; | ||
v_pr_k = x*y1 - x1*y; | ||
cout << "Vektornoe proizvedenie= " << "(" << v_pr_i << ";" << v_pr_j << ";" << v_pr_k << ")" << endl; | ||
|
||
|
||
|
||
} | ||
|
||
float ed_v(float dl_v, int a){ | ||
float b = a / dl_v; | ||
return b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
|
||
using namespace std; | ||
|
||
float perimetr(float a); | ||
float perimetr(float a, float b); | ||
float perimetr(float a, float b, float c, float d); | ||
float square(float a); | ||
float square(float a, float b); | ||
float square(float a, float b, float h); | ||
int main(){ | ||
float pi = 3.14; | ||
float a; | ||
float b,c,d,h; | ||
cout << "Vvedite storony kvadrata" << endl; | ||
cin >> a; | ||
cout << "square kvadrata = " << square(a) << "\nperimetr kvadrata = " << perimetr(a) << endl; | ||
cout << "Vvedite R kruga" << endl; | ||
cin >> a; | ||
cout << "square kruga = " << square(pi,a) << "\nperimetr kruga = " << perimetr(a,pi) << endl; | ||
cout << "Vvedite storoni trapecii(a,b - storoni osnovaniya) i visoty" << endl; | ||
cout << "a:"; | ||
cin >> a; | ||
cout << "b:"; | ||
cin >> b; | ||
cout << "c:"; | ||
cin >> c; | ||
cout << "d:"; | ||
cin >> d; | ||
cout << "h:"; | ||
cin >> h; | ||
cout << "square trapecii = " << square(a,b,h) << "\nperimetr trapecii = " << perimetr(a,b,c,d) << endl;//123 | ||
} | ||
|
||
float perimetr(float a){ | ||
return 4*a; | ||
} | ||
float perimetr(float a, float pi){ | ||
return 2*a*pi; | ||
} | ||
float perimetr(float a, float b, float c, float d){ | ||
return a+b+c+d; | ||
} | ||
float square(float a){ | ||
return a*a; | ||
} | ||
float square(float pi, float b){ | ||
return pi*b*b; | ||
} | ||
float square(float a, float b, float h){ | ||
return ((a+b)/2)*h; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <iostream> | ||
#include <cstdio> | ||
#include <cmath> | ||
using namespace std; | ||
float funk( float a, float b,float x) { | ||
float y; | ||
while (x < 0.36) | ||
{ | ||
y = asin(pow(x,a)) + acos(pow(x,b)); | ||
x = x+ 0.05; | ||
cout << " "; | ||
printf ("%g", y); | ||
} | ||
cout << "\n"; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
#include <cstdio> | ||
#include <cmath> | ||
using namespace std; | ||
float funk( float a, float b, float _array_x[],int n){ | ||
float y; | ||
|
||
|
||
for (int i=0; i<n; i++) | ||
{ | ||
y = asin(pow(_array_x[i],a)) + acos(pow(_array_x[i],b)); | ||
std::cout << " "; | ||
printf ("%g", y); | ||
|
||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include <iostream> | ||
#include <random> | ||
using namespace std; | ||
|
||
|
||
void fun(int rows,int col,int **arr){ | ||
srand( time(0) ); | ||
for ( int i=0; i < rows; i++) | ||
for ( int j=0; j < col; j++) | ||
arr[i][j]= rand() % 30; | ||
|
||
} | ||
void fun2(int rows,int col,int **arr){ | ||
for ( int i=0; i < rows; i++){ | ||
for ( int j=0; j < col; j++) | ||
cout << arr[i][j] << "\t"; | ||
cout << endl; | ||
} | ||
} | ||
|
||
void fun3(int rows, int col,int n,int **arr){ | ||
for ( int i=0; i < rows; i++){ | ||
for ( int j=0; j < col; j++){ | ||
if (arr[i][j] > n){ | ||
n=arr[i][j]; | ||
|
||
} | ||
} | ||
|
||
} | ||
cout << "MAX из элементов = " << n <<endl; | ||
n=0; | ||
} | ||
void fun4 (int rows,int col,int n, int **arr,int *arr2){ | ||
for ( int i=0; i < rows; i++){ | ||
for ( int j=0; j < col; j++){ | ||
if (arr[i][j] > n){ | ||
n=arr[i][j]; | ||
|
||
} | ||
|
||
} | ||
cout << "MAX из строки = " << n <<endl; | ||
arr2[i]=n; | ||
n=0; | ||
} | ||
} | ||
void fun5(int rows,int *arr){ | ||
for(int i=0; i < rows; i++) | ||
{ | ||
cout << arr[i] <<"\t"; | ||
} | ||
} | ||
|
||
|
||
int main() { | ||
int n=0; | ||
int rows; | ||
int col; | ||
|
||
|
||
cout << "rows = "; | ||
cin >> rows; | ||
|
||
cout << "col = "; | ||
cin >> col; | ||
|
||
int *arr = new int [rows]; | ||
|
||
int **arr2 = new int *[rows]; | ||
for (int i=0; i<rows;i++) | ||
arr2[i]=new int [col]; | ||
|
||
|
||
fun(rows,col,arr2); | ||
fun2(rows,col,arr2); | ||
fun3( rows, col,n,arr2); | ||
fun4 (rows, col,n,arr2,arr); | ||
|
||
cout <<endl; | ||
cout << "массив с MAX значениями: " <<endl; | ||
|
||
fun5 ( rows, arr); | ||
|
||
for ( int i=0; i < rows; i++) | ||
delete [] arr2[i]; | ||
delete [] arr2; | ||
|
||
|
||
|
||
delete [] arr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
float funk( float a, float b, float x); | ||
float funk( float a,float b, float _array_x[],int n); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <iostream> | ||
#include <cstdio> | ||
#include <cmath> | ||
#include "function.h" | ||
#include "objects.h" | ||
using namespace std; | ||
|
||
|
||
int main() | ||
{ | ||
float _array_x[5] = {0.08, 0.26, 0.35, 0.41, 0.53}; | ||
int n = sizeof(_array_x)/sizeof(_array_x[0]); | ||
int result = funk( a, b, x); | ||
std::cout << "\n " << std::endl; | ||
int result2 = funk( a, b, _array_x,n); | ||
std::cout << "\n " << std::endl; | ||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Во-первых, добавляйте файлы на свою ветку.
Во-вторых, большинство программ я у Вас проверила и написала несколько комментариев, если что-то не отобразилось, то перейдите на вкладку Pull request -> Closed и отфильтруйте все запросы по автору svvan45
В-третьих, проверила Вашу работу по отрисовке фигур. Вы над заданием не видели магический заголовок ООП? Он означает, что при выполнении задания нужно применить принципы ООП.
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.
Да, классы. Возможно, есть смысл создать абстрактный класс.