Error occurred when fetching sidebar data
Feature
calculator.cpp +130 -0
main.cpp +375 -0
+ 130
- 0
+ 375
- 0
19 | cout << "2: Multiplication\t" << "8: Cos\t\t" << "\t\t14: Log with base 10" << endl; | |
20 | cout << "3: Subtraction\t\t" << "9: Tan\t\t" << endl; | |
21 | cout << "4: Addition\t\t" << "10: Inverse of Sin" << endl; | |
22 | cout << "5: Exponent\t\t" << "11: Inverse of Cos" << endl; | |
23 | cout << "6: Square root\t\t" << "12: Inverse of Tan" << endl; | |
24 | cout << "Enter the function that you want to perform : "; | |
25 | cin >> c; | |
26 | PI = 3.14159265; | |
27 | switch (c) | |
28 | { | |
29 | case 1: | |
30 | cout << "Enter 1st number : "; | |
31 | cin >> a; | |
32 | cout << "Enter 2nd number : "; | |
33 | cin >> b; | |
34 | cout << "Division = " << a / b << endl; | |
Please register or sign in to reply |
51 | system("pause"); | |
52 | break; | |
53 | case 4: | |
54 | cout << "Enter 1st number : "; | |
55 | cin >> a; | |
56 | cout << "Enter 2nd number : "; | |
57 | cin >> b; | |
58 | cout << "Addition = " << a + b << endl; | |
59 | system("pause"); | |
60 | break; | |
61 | case 5: | |
62 | cout << "Enter the number : "; | |
63 | cin >> a; | |
64 | cout << "Enter the exponent : "; | |
65 | cin >> b; | |
66 | cout << "Exponent = " << pow(a, b) << endl; | |
|
57 | cin >> b; | |
58 | cout << "Addition = " << a + b << endl; | |
59 | system("pause"); | |
60 | break; | |
61 | case 5: | |
62 | cout << "Enter the number : "; | |
63 | cin >> a; | |
64 | cout << "Enter the exponent : "; | |
65 | cin >> b; | |
66 | cout << "Exponent = " << pow(a, b) << endl; | |
67 | system("pause"); | |
68 | break; | |
69 | case 6: | |
70 | cout << "Enter the number : "; | |
71 | cin >> a; | |
72 | cout << "Square Root = " << sqrt(a) << endl; | |
|
99 | case 11: | |
100 | cout << "Enter the number : "; | |
101 | cin >> a; | |
102 | cout << "Inverse of Cos = " << acos(a)*180.0 / PI << endl; | |
103 | system("pause"); | |
104 | break; | |
105 | case 12: | |
106 | cout << "Enter the number : "; | |
107 | cin >> a; | |
108 | cout << "Inverse of tan = " << atan(a)*180.0 / PI << endl; | |
109 | system("pause"); | |
110 | break; | |
111 | case 13: | |
112 | cout << "Enter the number : "; | |
113 | cin >> a; | |
114 | cout << "Log = " << log(a) << endl; | |
|
93 | ||
94 | case 6: | |
95 | cout<<"Display BST:"<<endl; | |
96 | bst.display(root,1); | |
97 | cout<<endl; | |
98 | break; | |
99 | case 7: | |
100 | exit(1); | |
101 | default: | |
102 | cout<<"Wrong choice"<<endl; | |
103 | } | |
104 | } | |
105 | } | |
106 | ||
107 | /* | |
108 | * insert Element in the Tree | |
|
33 | BST() | |
34 | { | |
35 | root = NULL; | |
36 | } | |
37 | }; | |
38 | /* | |
39 | * Main Contains Menu | |
40 | */ | |
41 | int main() | |
42 | { | |
43 | int choice, num; | |
44 | BST bst; | |
45 | node *temp; | |
46 | while (1) | |
47 | { | |
48 | cout<<"-----------------"<<endl; | |
|
55 | ||
56 | cout<<"5.Postorder Traversal"<<endl; | |
57 | cout<<"6.Display"<<endl; | |
58 | cout<<"7.Quit"<<endl; | |
59 | cout<<"Enter your choice : "; | |
60 | cin>>choice; | |
61 | switch(choice) | |
62 | { | |
63 | case 1: | |
64 | temp = new node; | |
65 | cout<<"Enter the number to be inserted : "; | |
66 | cin>>temp->info; | |
67 | bst.insert(root, temp); | |
68 | break; | |
69 | case 2: | |
70 | if (root = NULL) | |
|
138 | ptrsave = ptr; | |
139 | if (item < ptr->info) | |
140 | ptr = ptr->left; | |
141 | else | |
142 | ptr = ptr->right; | |
143 | } | |
144 | *loc = NULL; | |
145 | *par = ptrsave; | |
146 | } | |
147 | ||
148 | /* | |
149 | * Inserting Element into the Tree | |
150 | */ | |
151 | void BST::insert(node *tree, node *newnode) | |
152 | { | |
153 | if (root = NULL) | |
|
Files with large changes are collapsed by default.
Files with large changes are collapsed by default.