Odpowiedź :
Wyjaśnienie:
Specyfikacja:
Dane wejściowe:
liczba x
Dane wyjściowe:
wartość liczbowa wyrażenia
[tex]\dfrac{\sqrt3+x^5}{-2+x}[/tex]
oraz wartość funkcji
[tex]f(x)=\left\{\begin{array}{ccc}2x&dla&x < 1\\(x-1)^4&dla&x=2\\\sqrt[3]{x+2}&dla&x=6\\0&dla&innych\ x\end{array}\right[/tex]
Kod:
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double x,w,f;
cout << "Podaj liczbę: ";
cin>>x;
if ((x<1)||(x==2)||(x==6)){
if (x<1)
f=2*x;
if (x==2)
f=pow((x-1),4);
if (x==6)
f=cbrt(x+2);}
else
f=0;
if (x!=2){
w=(sqrt(3)+pow(x,5))/(-2+x);
cout<<w<<endl<<f;}
else{
cout<<"Dla x = 2 otrzymujemy w mianowniku wyrażenia 0. A dzielenie przez 0 jest niewykonywalne."<<endl;
cout<<f<<endl;}
}