and my code:
Hope you understund what I need, because to me its difficul to explain.. my eng is not good enough.. Just look at picture..
Thanks ;)
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
float x, n, p;
cout << "Insert a number x!\n";
cin >> x;
cout << "Type an exponent n!\n";
cin >> n;
{
p = pow(x, n);
cout.precision(2);
cout.setf (ios::fixed);
cout << "Degree is: " <<p <<endl;
if (n<0);
cout << "Programm is complited because it was given a negative exponent!" <<endl;
}
if (n<0)
system ("pause");
return 0;
}
#include <iostream>
#include <cmath>
usingnamespace std;
int main ()
{
int x, n, p;
cout << "Insert a number x!\n";
cin >> x;
cout << "Type an exponent n!\n";
cin >> n;
p = pow(x, n);
cout.precision(2);
cout.setf (ios::fixed);
if (n < 0)
cout << "Programm is complited because it was given a negative exponent!" <<endl;
else
cout << "Degree is: " <<p <<endl;
return 0;
}
#include <iostream>
#include <cmath>
usingnamespace std;
int main ()
{
double x, n, p;
do
{
cout << "Insert a number x!\n";
cin >> x;
cout << "Type an exponent n!\n";
cin >> n;
p = pow(x, n);
cout.precision(2);
cout.setf (ios::fixed);
if (n < 0)
cout << "Programm is complited because it was given a negative exponent!" <<endl;
else
cout << "Degree is: " <<p <<endl;
}while (n > 0);
system ("pause");
return 0;
}