Ответ:
На отрезке по оси обсцис от 0 до 9 узнать ординату, где функция =√х
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double r, s, c;
cin >> r;
s = M_PI*r*r;
c = 2*M_PI*r;
cout.setf(ios::fixed);
cout.precision(3);
cout << s << "\n" << c << "\n";
return 0;
}
Пример:
5
<span>78.540
31.416</span>
Readln как и read вводит переменную командой read (x); также и readln (x); но перед этим надо в var внести переменную x
#include <iostream>
#include <conio.h>
float mathFunc(float x) {
if (x < 0)
return 2 * x;
else if (x > 0)
return x * x + 10;
return 0;
}
int main() {
setlocale(LC_ALL, "");
std::cout << mathFunc(-1) << " " << mathFunc(0) << " " << mathFunc(1);//проверка
_getch();
return 0;
<span>}
//1
</span>#include <iostream>
#include <conio.h>
int main() {
setlocale(LC_ALL, "");
int year;
while (true) {
system("cls");
std::cout << "Введите год своего рождения:";
std::cin >> year;//год может быть отрицательным => до н.э.
year = 2017 - year;
printf("Вам %d лет,", year);
if (year < 45)
printf("вы молоды");
else if (year < 60)
printf("вы среднего возраста");
else if (year < 75)
printf("вы пожилого возраста");
else if (year > 90)
printf("вы старческого возраста");
<span>_getch();
</span><span>return 0;
}
//2
</span>