Advertisement
R0M41K

ploschi

Apr 2nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #include <cmath>
  4. #include <windows.h>
  5. void SetColor(int text, int background)
  6. {
  7. HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  8. SetConsoleTextAttribute(hStdOut, (WORD)((background << 4) | text));
  9. }
  10. int main(){
  11. float a, r, s0, s4;
  12. setlocale(0,"");
  13. cout << "Введіть сторону квадрата а: ";
  14. cin >> a;
  15. cout << "Введіть сторону квадрата R: ";
  16. cin >> r;
  17. s0 = 3.14*r*r;
  18. s4 = a*a;
  19. cout << "\nПлоща квадрата: ";
  20. SetColor(3,0);
  21. cout << s4;
  22. SetColor(15, 0);
  23. cout << "\nПлоща круга: ";
  24. SetColor(3, 0);
  25. cout << s0;
  26. SetColor(15, 0);
  27. if (s4>s0) cout << "\nПлоща квадрата більша\n";
  28. if (s4<s0) cout << "\nПлоща круга більша\n";
  29. if (s4==s0) cout << "\nПлощі рівні\n";
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement