?>
A. A + B (float) time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output You are given two decimals a and b. Print a + b. Input The first line contains a decimal a and the second line contains a decimal b(-1000.0 Sa, b S 1000.0 Output Print a + b. Examples input 3.6 4.25 output 7.85 input 7.23 -3.33 output 3.9 input -5.68 -11.789 output -17.469
Ответы
#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;
}
Объяснение:
Надеюсь, тебе не поставят два за это
Замени мои матные выражения в "" и можешь сдавать