Advertisement
Handde

P 4.3

May 18th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <iostream>
  3. #define PI 3.141592
  4. using namespace std;
  5.  
  6. void fkonus(float r1, float r2, float h, float *s, float *v)
  7.  
  8. {
  9. *v = PI*h*(r1*r1 + r1*r2 + r2*r2)/3;
  10. *s = PI*r2*r2;
  11.  
  12. }
  13. int main() {
  14. setlocale(LC_ALL, "Bulgarian");
  15. float r1, r2, s, v, h;
  16. cout << "Vavedete radiusa na dolnata osnova:"; cin >> r1;
  17. cout << "Vavedete radiusa na gornata osnova:"; cin >> r2;
  18. cout << "Vavedete visochina na konusa:"; cin >> h;
  19.  
  20. fkonus(r1, r2, h, &s, &v);
  21. cout << endl << "Obema na konusa e:"; printf("%.2f\n", v);
  22. cout << "Liceto na konusa e:"; printf("%.2f\n", s); cout << endl;
  23.  
  24. cout << endl;
  25. system("pause");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement