Скажи училке, чтобы писала человеческим языком а не этой хуйней блять, задача изи, но написано так что нихуя непонятно
#include "stdafx.h" #include <iostream> using namespace std; void CalculateFunction(double a,double b,double xn,double xk,double dx){ double y = 0; for(double x = xn;x<=xk;x+=dx){ if(x>=7){ y = abs(x/b)/a; } else if(x<=-8){ y = (x)/(sqrt(b)*a); } else if(x>-6 && x<1){ y = x/a; } cout<<"x = "<<x<<" y = "<<y<<endl; } } int main(){ double a,b,xn,xk,dx; cout<<"Input a"<<endl; cin>>a; cout<<"Input b"<<endl; cin>>b; cout<<"Input xn"<<endl; cin>>xn; cout<<"Input xk"<<endl; cin>>xk; cout<<"Input dx"<<endl; cin>>dx; CalculateFunction(a,b,xn,xk,dx); return 0; } Код #include "stdafx.h" #include <iostream> using namespace std; void CalculateFunction(double a,double b,double xn,double xk,double dx){ double y = 0; for(double x = xn;x<=xk;x+=dx){ if(x>=7){ y = abs(x/b)/a; } else if(x<=-8){ y = (x)/(sqrt(b)*a); } else if(x>-6 && x<1){ y = x/a; } cout<<"x = "<<x<<" y = "<<y<<endl; } } int main(){ double a,b,xn,xk,dx; cout<<"Input a"<<endl; cin>>a; cout<<"Input b"<<endl; cin>>b; cout<<"Input xn"<<endl; cin>>xn; cout<<"Input xk"<<endl; cin>>xk; cout<<"Input dx"<<endl; cin>>dx; CalculateFunction(a,b,xn,xk,dx); return 0; } --- Сообщение объединено с предыдущим 22 апр 2020
emptyc version 2.0 #include "stdafx.h" #include <iostream> using namespace std; int main(){ cout<<"Input a,b,xn,xk,dx"<<endl; double a,b,xn,xk,dx,y; cin>>a>>b>>xn>>xk>>dx; for(double x = xn;x<=xk;x+=dx) { y = (x>=7)?abs(x/b)/a:(x<=-8)?x/(sqrt(b)*a):(x>-6 && x<1)?x/a:y; cout<<"x = "<<x<<" y = "<<y<<endl; } return 0; } Код #include "stdafx.h" #include <iostream> using namespace std; int main(){ cout<<"Input a,b,xn,xk,dx"<<endl; double a,b,xn,xk,dx,y; cin>>a>>b>>xn>>xk>>dx; for(double x = xn;x<=xk;x+=dx) { y = (x>=7)?abs(x/b)/a:(x<=-8)?x/(sqrt(b)*a):(x>-6 && x<1)?x/a:y; cout<<"x = "<<x<<" y = "<<y<<endl; } return 0; }