Skip to content

Commit 041c44a

Browse files
authored
Merge pull request #3 from AnnaChekanova/main
add solution p n10
2 parents 2f7a278 + bc174ba commit 041c44a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ https://github.com/DaniilVdovin/Material-Pointer-Cpp/blob/e5cfa15c414922db5fef19
2222
https://github.com/DaniilVdovin/Material-Pointer-Cpp/blob/e5cfa15c414922db5fef19389cffbb7691890eca/Source/Pointers/8.cpp#L1-L16
2323
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.
2424
https://github.com/DaniilVdovin/Material-Pointer-Cpp/blob/e5cfa15c414922db5fef19389cffbb7691890eca/Source/Pointers/9.cpp#L1-L22
25-
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.
25+
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.
26+
https://github.com/AnnaChekanova/Material-Pointer-Cpp/blob/e3f101dab201b4dd84f157f35bd79578ee24133c/Source/Pointers/10.cpp#L1C1-L16
2627
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.
2728
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.
2829
13. ❌ Write a function that takes age (number of years) as an argument and returns the number of months, days, hours and minutes lived.

Source/Pointers/10.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <iostream>
2+
#include <math.h>
3+
using namespace std;
4+
void fun(float* A, float* B, float* C, float* Perimeter, float* Square) {
5+
*Perimeter = *A + *B + *C;
6+
float p = (*A + *B + *C) / 2;
7+
*Square = sqrtf(p * (p - *A)* (p - *B)* (p - *C));
8+
}
9+
int main() {
10+
float A, B, C, Perimeter, Square;
11+
cin >> A >> B >> C;
12+
fun(&A, &B, &C, &Perimeter, &Square);
13+
cout.precision(2);
14+
cout << fixed << Perimeter << " " << Square << " " << endl;
15+
return 0;
16+
}

0 commit comments

Comments
 (0)