Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Вычисление площади фигуры1 / LABA0
.CPP#include<iostream.h>;//Stream library
#include<math.h>//Math library
#include<values.h>//Values library
#include<conio.h>//Screen library
float sq(float r0)
{
float square;
square = M_PI_2*r0*r0-4*r0*r0/5;
return square;
}
int check(float r0)
{
if ((r0<0) || (r0>100))
{
cout << "Radius incorrect";
return 0;
}
return 1;
}
void main(void)//Main function that calculates area
{
float r = 0; //Radius of circle that domain depends on
/*Begin of greeting*/
clrscr();
cout << "\n";
cout <<
"Welcome.\n"
<<
"This is programm that calculates domain area, that depends on radius (R).\n";
/*End of greeting*/
/*Begin of requirement*/
do
{
do
{
cout << "\nPlease insert radius of circle [0," << "100" << "]:\n" << "r=";
cin >> r;
}
while ((!check(r)));
cout << "Nessesary area is: " << sq(r); //Result printing
cout << "\n\nThank you for using our programm.\n" //
<< "All rights reserved. (c)\n";//Parting
cout << "\n" << "For exit press Esc. ";
}
while(getch()!=27);
/*End of requirement*/
//getch();
}