Home
О нас
Products
Services
Регистрация
Войти
Поиск
Ha3gyl
@Ha3gyl
December 2021
1
3
Report
Помогите пожалуйста! Беда с рекурсиями, С++.
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
petyaGavrikov
Verified answer
#include <iostream>
#include <cmath>
using namespace std;
double f(double x, int n)
{
if (n > 0) return (f(tan(n*M_PI/2+x),n-1));
else return (x);
}
int main()
{
int n ;
double x;
cout << "n = ";
cin >> n;
cout << "x = ";
cin >> x;
cout << tan(M_PI/2 + tan(2*M_PI/2 + tan(3*M_PI/2 + tan(4*M_PI/2+x)))) << "\n";
cout << "tg() = " << f(x,n) << "\n";
system("Pause");
return 0;
}
Пример:
n = 4
x = 1
74.677
tg() = 74.677
1 votes
Thanks 1
More Questions From This User
See All
Ha3gyl
August 2022 | 0 Ответы
pozhalujsta srochno nuzhno pomogite napisat programmu na c zadanie prilozheno
Answer
Ha3gyl
August 2022 | 0 Ответы
napisat programmu na yazyke c 1 opisat strukturu s imenem marsh soderzhashuyu
Answer
Ha3gyl
August 2022 | 0 Ответы
programma na c opisat klass mnogochlenov ot odnoj peremennoj zadavaemyh step
Answer
Ha3gyl
August 2022 | 0 Ответы
pomogite pozhalujstav pryamougolnom parallelepipede abcda1b1c1d1 izvestny rebra
Answer
Ha3gyl
July 2022 | 0 Ответы
pomogite napisat programmu na ccelocislennaya arifmetika najti naibolshuyu i
Answer
Ha3gyl
July 2022 | 0 Ответы
pomogite pozhalujsta budu ochen priznatelen kod na c napisat programmu kot
Answer
Ha3gyl
July 2022 | 0 Ответы
proshu pomogite pozhalujsta nado napisat kod na yazyke c vychislit x sina
Answer
Ha3gyl
July 2022 | 0 Ответы
razrabotat programmu na yazyke s sootvetstvuyushuyu zadaniyu i razrabotat sootv
Answer
Ha3gyl
July 2022 | 0 Ответы
pomogite sostavit kod i blok shemu na yazyke c dinamicheskij dvuhmernyj massiv
Answer
Ha3gyl
July 2022 | 0 Ответы
napisat programmu na yazyke ccherez printf scanf podschitat kolichestvo cely
Answer
рекомендуемые вопросы
rarrrrrrrr
August 2022 | 0 Ответы
o chem dolzhny pozabotitsya v pervuyu ochered vzroslye pri organizacionnom vyvoze n
danilarsentev
August 2022 | 0 Ответы
est dva stanka na kotoryh vypuskayut odinakovye zapchasti odin proizvodit a zapcha
myachina8
August 2022 | 0 Ответы
najti po grafiku otnoshenie v3v1 v otvetah napisano 9 no nuzhno reshenie
ydpmn7cn6w
August 2022 | 0 Ответы
Choose the correct preposition: 1.I am fond (out,of,from) literature. 2.where ar...
millermilena658
August 2022 | 0 Ответы
opredelite kak sozdavalas i kto sozdaval arabskoe gosudarstvo v kracii
MrZooM222
August 2022 | 0 Ответы
ch ajtmanov v rasskaze krasnoe yabloko ispolzuet metod rasskaz v rasskaze opi
timobila47
August 2022 | 0 Ответы
kakovo bylo naznachenie kazhdoj iz chastej vizantijskogo hrama pomogite pozhalujsta
ivanyyaremkiv
August 2022 | 0 Ответы
moment. 6....
pozhalujsta8b98a56c0152a07b8f4cbcd89aa2f01e 97513
sarvinozwakirjanova
August 2022 | 0 Ответы
pomogite pozhalusto pzha519d7eb8246a08ab0df06cc59e9dedb 6631
×
Report "Помогите пожалуйста! Беда с рекурсиями, С++..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
#include <iostream>#include <cmath>
using namespace std;
double f(double x, int n)
{
if (n > 0) return (f(tan(n*M_PI/2+x),n-1));
else return (x);
}
int main()
{
int n ;
double x;
cout << "n = ";
cin >> n;
cout << "x = ";
cin >> x;
cout << tan(M_PI/2 + tan(2*M_PI/2 + tan(3*M_PI/2 + tan(4*M_PI/2+x)))) << "\n";
cout << "tg() = " << f(x,n) << "\n";
system("Pause");
return 0;
}
Пример:
n = 4
x = 1
74.677
tg() = 74.677