-
Notifications
You must be signed in to change notification settings - Fork 0
/
charpter7(1).txt
130 lines (128 loc) · 2.46 KB
/
charpter7(1).txt
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
A
/*
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std ;
double pi = 3.14 ;
class cirle
{
private:
double r ;
public:
void get_r(double _r) {r = _r;}
double outGet_r() {return pi*2*r;}
double outGet_s() {return pi*r*r ; }
}s ;
int main()
{
double a ; cin >> a ;
s.get_r(a) ;
cout << "周长" <<s.outGet_r() << " "<< "面积" << s.outGet_s() << endl ;
return 0 ;
}
*/
B
/*
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std ;
double pi = 3.14 ;
class sqa
{
private:
double length , wide;
double s ;
public:
void get(double _length , double _wide)
{
length = _length ;
wide = _wide ;
s = length * wide ;
}
double outS()
{return s;}
};
double maxn(double a , double b)
{return a > b ? a : b ; }
int main()
{
sqa *a1, *a2 , *a3 ;
a1 = new sqa ;
a1->get(5.2 , 4.3) ;
a2 = new sqa ;
a2->get(100,20) ;
a3 = new sqa ;
double a , b ; cin >> a >> b ;
a3->get(a,b) ;
cout << maxn(maxn(a1->outS() , a2->outS()),a3->outS()) << endl ;
return 0 ;
}
*/
C
/*
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std ;
double pi = 3.14 ;
class tri
{
private:
int a[3] ;
private:
bool equileteral()
{
if(a[0] == a[1] && a[1] == a[2])
return true ;
else return false ;
}
bool isosceles()
{
if(a[0] == a[1] || a[1] == a[2])
return true ;
else return false ;
}
bool right()
{
if(a[0] * a[0] + a[1] * a[1] == a[2] * a[2])
return true ;
else return false ;
}
public:
void get(int _a[])
{
for( int i = 0 ; i< 3 ; i++)
a[i] = _a[i] ;
}
void out()
{
if(equileteral()) {cout << "A equileteral triangle" << endl ; return ; }
if(isosceles()) {cout << "A isosceles triangle" << endl ; return ; }
if(right()) {cout << "A right triangle" << endl ; return ;}
cout << "A triangle" << endl ;
}
} ;
bool check(int a[])
{
if(a[0] + a[1] <= a[2]) return false ;
return true ;
}
int main()
{
int a[3] ;
for( int i = 0 ; i < 3 ; i++ )
cin >> a[i] ;
sort(a , a+3) ;
if(!check(a)) {cout << "Not a triangle" << endl; return 0 ;}
tri *s ;
s = new tri ;
s->get(a) ;
s->out() ;
return 0 ;
}
*/