Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
19
Добавлен:
12.02.2015
Размер:
833 б
Скачать
#include<stdio.h>
#include<stdlib.h>

using namespace std;



int main()
{
float a, b, c; // стороны кирпича
float x, y; // стороны отверстия

printf("Enter brick dimensions: ");

if (scanf("%f%f%f", &a, &b, &c) == 3)
{
if (a <= 0 || b <= 0 || c <= 0)
{
printf("\nError!\n");
system("pause");
return 0;
}
else
{
printf("\nEnter hole dimensions: ");
if (scanf("%f%f", &x, &y) == 2)
{
if (x <= 0 || y <= 0)
{
printf("\nError!\n");
system("pause");
return 0;
}
else
{
if ( (a <= x && b <= y) || (a <= x && c <= y) || (c <= x && b <= y) || (c <= x && a <= y) || (b <= x && c <= y) || (b <= x && a <= y) )
// проверяем проходит ли кирпич
{
printf("Brick is in hole\n");
}
else
{
printf("Brick is too big\n");
}
}
}
}
}
else
{
printf("\nError!\n");
}

system("pause");
return 0;
}
Соседние файлы в папке c++ 2 курс