Розробка програм з циклами

Інформація про навчальний заклад

ВУЗ:
Інші
Інститут:
Не вказано
Факультет:
Не вказано
Кафедра:
Не вказано

Інформація про роботу

Рік:
2019
Тип роботи:
Лабораторна робота
Предмет:
Алгоритмічні мови та програмування Частина 2

Частина тексту файла (без зображень, графіків і формул):

Звіт з лабораторної роботи №5 «Розробка програм з циклами» з дисципліни: «Алгоритмічні мови та програмування» Laboratory work №4 Розробка програм з циклами The purpose of the work: To learn the types of cyclic algorithms and cyclic operators in C ++. Variant:4 Дотаток 1 a) - + C++ code #include <iostream> #include <cmath> using namespace std; int main() { double y, x=2.3; for (int a=1; a<5; a++) { y=x+cos(2*x)/3*x; cout << a <<"\t"<< "x=" << x << "\t" << "y=" << y<<endl; x+=0.8; } return 0; } / б) C++ code #include <iostream> #include<cmath> using namespace std; int main() { float y,x=1.2; for(int n=1; n<8;n++){ y=x+cos(2*x)/3*x; cout<< n << "\t" << "x=" << x << "\t"<<"y="<< y << endl; x+=0.2; } return 0; } / Додаток 2 - + + - + C++ code #include <iostream> #include<cmath> using namespace std; int main() { double x,y; cout<< "x="; cin >> x; if (x>=-2 && x<=0){ y=sin(x)+exp(x); cout<<"y="<<y; } else if(0<x && x<=3){ y=atan2(x-0,3); for(int a=1; a<16;a++){ cout<<a<<"\t"<<"x="<<x<<"\t"<<"y="<<y<<endl; x+=0.5; } } else { cout<<"hello"; } return 0; } / Conclusion: we learned to make programs with using of cyclic operators in the environment of CodeBlocks. Cycles are needed, when we are necessary to repeat some actions a few times, as a rule, while some condition is executed. In C programming language three types of iteration statement are known: for, while and do-while.
Антиботан аватар за замовчуванням

05.02.2019 20:18

Коментарі

Ви не можете залишити коментар. Для цього, будь ласка, увійдіть або зареєструйтесь.

Ділись своїми роботами та отримуй миттєві бонуси!

Нічого не вибрано
0%

Оголошення від адміністратора

Антиботан аватар за замовчуванням

Подякувати Студентському архіву довільною сумою

Admin

26.02.2023 12:38

Дякуємо, що користуєтесь нашим архівом!