Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <iostream>
- using namespace std;
- double func(float x)
- {
- return (cos(8*x))/sqrt(1+10*x);
- }
- void RegCikl(float a,float b, float h,float& sum)
- {
- double x,y;
- cout<<"Таблица значений функции: "<<endl;
- cout<<"\tx=\ty="<<endl;
- for(x = 0; x < b; x+=h){
- y = func(x);
- cout << "\t" << x << "\t" << y << "\n";
- if(y>0) sum+=y;
- }
- }
- void GetABH(float& a,float& b,float& h)
- {
- setlocale(LC_ALL,"rus");
- cout<<"Введите начало отрезка ";
- cin>>a;
- cout<<"Введите конец отрезка ";
- cin>>b;
- cout<<"Введите шаг табулирования ";
- cin>>h;
- }
- void Put(float sum)
- {
- setlocale(LC_ALL,"rus");
- cout<<" Сумма значений функции "<<sum<<endl;
- }
- int main()
- {
- float a,b,h;
- GetABH(a,b,h);
- float sum=0;
- RegCikl(a,b,h,sum);
- Put(sum);
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement