Skip to content

Commit

Permalink
Merge pull request #3 from AnnaChekanova/main
Browse files Browse the repository at this point in the history
add solution p n10
  • Loading branch information
DaniilVdovin authored May 22, 2023
2 parents 2f7a278 + bc174ba commit 041c44a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ https://github.com/DaniilVdovin/Material-Pointer-Cpp/blob/e5cfa15c414922db5fef19
https://github.com/DaniilVdovin/Material-Pointer-Cpp/blob/e5cfa15c414922db5fef19389cffbb7691890eca/Source/Pointers/8.cpp#L1-L16
9. :white_check_mark: Write a function that takes two numbers as arguments and returns a reduced fraction (25 15, 5/3). Write a program to demonstrate how this function works.
https://github.com/DaniilVdovin/Material-Pointer-Cpp/blob/e5cfa15c414922db5fef19389cffbb7691890eca/Source/Pointers/9.cpp#L1-L22
10. ❌ Write a function that takes three sides of a triangle as arguments and returns the perimeter of the triangle and the area calculated using the Heron formula. Write a program to demonstrate how this function works.
10. :white_check_mark: Write a function that takes three sides of a triangle as arguments and returns the perimeter of the triangle and the area calculated using the Heron formula. Write a program to demonstrate how this function works.
https://github.com/AnnaChekanova/Material-Pointer-Cpp/blob/e3f101dab201b4dd84f157f35bd79578ee24133c/Source/Pointers/10.cpp#L1C1-L16
11. ❌ Write a function that takes the value of the acute angle of a right-angled triangle and the length of the hypotenuse as arguments, and returns the length of the legs, the area of the triangle and the radius of the circumscribed circle. Write a program to demonstrate how this function works.
12. ❌ Write a function that takes the base of an isosceles trapezoid as arguments and returns the perimeter, area and height of the trapezoid. Write a program to demonstrate how this function works.
13. ❌ Write a function that takes age (number of years) as an argument and returns the number of months, days, hours and minutes lived.
Expand Down
16 changes: 16 additions & 0 deletions Source/Pointers/10.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <iostream>
#include <math.h>
using namespace std;
void fun(float* A, float* B, float* C, float* Perimeter, float* Square) {
*Perimeter = *A + *B + *C;
float p = (*A + *B + *C) / 2;
*Square = sqrtf(p * (p - *A)* (p - *B)* (p - *C));
}
int main() {
float A, B, C, Perimeter, Square;
cin >> A >> B >> C;
fun(&A, &B, &C, &Perimeter, &Square);
cout.precision(2);
cout << fixed << Perimeter << " " << Square << " " << endl;
return 0;
}

0 comments on commit 041c44a

Please sign in to comment.