#include <iostream>
#include <math.h>
const double g = 9.08665;
int main() {
unsigned int h;
std::cout << "Enter height of tree :" ;
std::cin>> h;
if (std::cin.fail()) // если предыдущее извлечение оказалось неудачным,
{
std::cin.clear();
std::cin.ignore(32767,'\n');
std::cout << "Please die";
return 2;
}
if(h == 0) {
std::cout<<"You are stupid! Apple is on the earth\n";
return 1;
}
std::cout<<"Program is thinking, but you no!\n";
double t = sqrt(2 * h / g);
std::cout << "Time is " << t << "\n";
std::cout << "Goodbye asshole\n";
return 0;
}
Объяснение:
Надеюсь, тебе не поставят два за это
Замени мои матные выражения в "" и можешь сдавать
Var a,b,c, D, Result : Integer;
Assign(InFile, "C:\kvur.txt");
Assign(OutFile, "C:\korni.txt")
Reset(InFile)
Read(InFile,a)
Read(InFile,b)
Read(InFile, c)
D = sqr(b) + 4*a*c
if D = 0 then
Write("Уравнение не имеет корней")
Else
Append(OutFile)
Result:=(-b + sqrt(D)) / 2 * a
Write(OutFile,Result)
Write("Корень уравнения")
WriteLn(Result)
if (D>0) then
Result:=(-b - sqrt(D)) / 2 * a
Write(OutFile, Result)
Write("Второй корень уравнения")
Write(Result)
End;
End.