Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #include <cmath>
- #include <windows.h>
- void SetColor(int text, int background)
- {
- HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleTextAttribute(hStdOut, (WORD)((background << 4) | text));
- }
- int main(){
- float a, r, s0, s4;
- setlocale(0,"");
- cout << "Введіть сторону квадрата а: ";
- cin >> a;
- cout << "Введіть сторону квадрата R: ";
- cin >> r;
- s0 = 3.14*r*r;
- s4 = a*a;
- cout << "\nПлоща квадрата: ";
- SetColor(3,0);
- cout << s4;
- SetColor(15, 0);
- cout << "\nПлоща круга: ";
- SetColor(3, 0);
- cout << s0;
- SetColor(15, 0);
- if (s4>s0) cout << "\nПлоща квадрата більша\n";
- if (s4<s0) cout << "\nПлоща круга більша\n";
- if (s4==s0) cout << "\nПлощі рівні\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement