Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int radius, side = 0;
- cout << "The program will determine whether the circle fits into the square.\n";
- bool IsCorrect;
- cout << "Enter radius: ";
- do
- {
- IsCorrect = false;
- cin >> radius;
- if ((cin.fail()) or (radius < 0) or (radius == 0))
- {
- IsCorrect = true;
- cout << "Incorrect value. Enter the number: ";
- }
- cin.clear();
- while (cin.get() != '\n');
- } while (IsCorrect);
- cout << "Enter side: ";
- do
- {
- IsCorrect = false;
- cin >> side;
- if ((cin.fail()) or (side < 0) or (side == 0))
- {
- IsCorrect = true;
- cout << "Incorrect value. Enter the number: ";
- }
- cin.clear();
- while (cin.get() != '\n');
- } while (IsCorrect);
- if (radius * 2 < side)
- {
- cout << "Fit in.\n" << endl;
- }
- else
- {
- cout << "Not fit in.\n" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement