Z funksiyani hisoblash algoritmining blok-sxemasiga mos ravishda C++ dasturlashtirish tilida dasturini tuzamiz.
#include #include #include using namespace std; int main() { float x,Z; cout<<"\n"; cout<<"x ning qiymatini kiriting, so'ng ENTER ni bosing x= "; cin>>x; if (x<=-1) Z=pow(x,3)+14*x+5.3; else Z=pow(x,5)-12.3; cout<<"\nnatija Z="< cout<<"\n"; system("pause"); return 0; }
Ushbu dasturni kompyuterning DEV C++ tizimiga kiritib natijalarini olish uchun F9 klavishini bosamiz va y ni qiymatlarini ko’rsatilgan oraliqlar bo’yicha kiritamiz.
x ning qiymatini kiriting, so'ng ENTER ni bosing x= -2.3 natija Z=-39.067 x ning qiymatini kiriting, so'ng ENTER ni bosing x= -1 natija Z=-9.7 x ning qiymatini kiriting, so'ng ENTER ni bosing x= 5.23 natija Z=3900.69