@Marmeladka
0 / 0 / 0
Регистрация: 22.11.2010
Сообщений: 32
|
|
|
19.04.2012, 23:00. Просмотров 372. Ответов 0
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
| #include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
class d
{
public:
double first;
int second;
double z;
void power()
{
cout<<" Введите число:\n";
cout<<"x=";
cin>>first;
cout<<" Введите показатель степени:\n";
cout<<"y=";
cin>>second;
cout<<"x^y=";
if(((first>0)&&(second>0)))
{
z = pow(first,second);
cout<<z<<"\n";
}
else
{
if((first<0)&&(second>0))
{
if((second%2)==0)
{
z = pow(first,second);
cout<<z<<"\n";
}
else
{
if((second%2)!=0)
{
z = pow(first,second);
cout<<z<<"\n";
}
}
}
}
if((first==0))
{
z=0;
cout<<z<<"\n";
}
else
{
if((first>0)&&(second<0))
{
z=1/(pow(second,first));
cout<<z<<"\n";
}
else
{
if(second==0)
{ z=1;
cout<<z<<"\n";
}
else
{
if((first<0)&&(second<0))
{cout<<"Считайте сами,такое даже калькулятор не считает:)"<<"\n"<<"\n";}
}
}}
}
};
int main()
{
setlocale(LC_ALL, "Russian");
d r;
r.power();
return 0;
} |
|
0
|