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
|
1 #include<iostream>
2 #include<cmath>
3 using namespace std;
4
5 void rect (double &width, double &length);
6 void trap (double &width, double &base1, double &base2);
7 void func1 (double &input);
8 void func2 (double &input);
9 void func3 (double &input);
10 void func4 (double &input);
11 void func5 (double &input);
12
13 int main (){
14
15 int choice1, choice2, numshapes, start, end;
16 double sumrect, sumtrap, area1, width, input, fa, base1, base2, area2, length, input2;
17 width = (end-start)/numshapes;
18 area1 = 0;
19 area2 = 0;
20
...
61 return 0;
62 }
63
64 void rect (double &width, double &length){
65 sumrect = width*length;
66 area1 = area1+sumrect;
67 }
68
69 void trap (double &width, double &base1, double &base2){
70 sumtrap = (base1+base2)*width/2;
71 area2 = area2+sumtrap;
72 }
73
74 void func1 (double &input){
75 fa = (5*pow(input,4))+(3*(pow(input,3)))-(10*input)+(2);
76 }
77
78 void func2 (double &input){
79 fa = (pow(input,2))-(10);
80 }
81
82 void func3 (double &input){
83 fa = (40*input)+(5);
84 }
85
86 void func4 (double &input){
87 fa = pow(input,3);
88 }
89
90 void func5 (double &input){
91 fa = (20*pow(input,2))+(10*input)-(2);
92 }
|