Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<windows.h>
- #include<iomanip>
- #include <math.h>
- using namespace std;
- double fi(double x);
- double Uxt (double x, double a, double t);
- int main(){
- system("chcp 1251 > nul");
- double a, t, U;
- cout<<"Введите Коэффициент жесткости (a) и Момент времени (t)"<<endl;
- cin>>a>>t;
- cout<<"x="<<setw(15)<<"U="<<endl;
- for (double x=0; x<=10; x+=0.5)
- {
- U=Uxt(x,a,t);
- cout<<fixed<<x<<setw(15)<<U<<endl;
- }
- }
- double fi(double x){
- double f;
- if ((x>=3.14) && (x<=6.28))
- f=-sin(x);
- else f=0;
- return f;
- }
- double Uxt(double x, double a, double t){
- double U;
- if (x-a*t<=0)
- U=(fi(x-a*t)+fi(x+a*t))/2;
- else U=(-fi(a*t-x)+fi(x+a*t))/2;
- return U;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement