-
Notifications
You must be signed in to change notification settings - Fork 0
/
Number Converter Calculator.cpp
206 lines (175 loc) · 5.1 KB
/
Number Converter Calculator.cpp
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#include<iostream>
#include<sstream>
#include<cstring>
#include<cmath>
#include<windows.h>
#include <unistd.h>
#include "NumberConverter.h"
using namespace std;
int main(){
string phrase ="Opening NUMBER CONVERSION CALCULATOR";
cout<<"\n\n\t\t\tLoading...";
string command = "espeak -v m2 \"" +phrase+"\"";
//cout<<"Opening the Decimal to Binary Calculator";
const char* charCommand=command.c_str();
system(charCommand);
system("cls");
int con;
system("Color F0");
// system("Color 7");
cout<<"\n\n\n";
cout<<"\t\t\t\t\t ******************************\n";
cout<<"\t\t\t\t\t *NUMBER CONVERSION CALCULATOR* \t\t\t\n";
cout<<"\t\t\t\t\t ******************************";
cout<<"\n\n\n\n";
cout<<"\t\t || PRESS 1 FOR DECIMAL NUMBER CONVERTER CALCULATOR ||\n";
cout<<"\t\t || PRESS 2 FOR BINARY NUMBER CONVERTER CALCULATOR ||\n";
cout<<"\t\t || PRESS 3 FOR OCTAL NUMBER CONVERTER CALCULATOR ||\n";
cout<<"\t\t || PRESS 4 FOR HEXADECIMAL NUMBER CONVERTER CALCULATOR ||\n";
cout<<endl;
cout<<" CHOOSE THE CALCULATOR : ";
cin>>con;
switch(con){
case 1 : {
system("cls");
string phrase ="Opening DECIMAL NUMBER CONVERTER CALCULATOR";
cout<<"\n\n\t\t\tLoading...";
string command = "espeak -v m3 \"" +phrase+"\"";
const char* charCommand=command.c_str();
system(charCommand);
system("cls");
int ch;
system("Color 74");
cout<<"\n\n";
cout<<"\t\t\t\t\t ________________________\n";
cout<<"\t\t\t\t\t |DECIMAL NUMBER CONVERTER| \t\t\t";
cout<<"\t\t\t\t\t |________________________| ";
cout<<"\n\n\n\n";
cout<<"\t\t || Press 1 for DECIMAL TO BINARY ||"<<endl;
cout<<"\t\t || Press 2 for DECIMAL TO OCTAL ||"<<endl;
cout<<"\t\t || Press 3 for DECIMAL TO HEXADECIMAL ||"<<endl;
cout<<endl;
cout<<"In which conversion you want to go ? ";
cin>>ch;
cout<<endl;
switch(ch){
case 1 : decimal_to_binary();
cout<<endl;
break;
case 2 : decimal_to_octal();
cout<<endl;
break;
case 3 : decimal_to_hexadecimal();
cout<<endl;
break;
default : cout<<"Invalid Input.";
}
break;
}
case 2: {
system("cls");
string phrase ="Opening BINARY NUMBER CONVERTER CALCULATOR";
cout<<"\n\n\t\t\tLoading...";
string command = "espeak -v m3 \"" +phrase+"\"";
const char* charCommand=command.c_str();
system(charCommand);
system("cls");
int ch;
system("Color B5");
cout<<"\n\n";
cout<<"\t\t\t\t\t ________________________\n";
cout<<"\t\t\t\t\t |BINARY NUMBER CONVERTER | \t\t\t";
cout<<"\t\t\t\t\t |________________________| ";
cout<<"\n\n\n\n";
cout<<"\t\t || Press 1 for BINARY TO DECIMAL ||"<<endl;
cout<<"\t\t || Press 2 for BINARY TO OCTAL ||"<<endl;
cout<<"\t\t || Press 3 for BINARY TO HEXADECIMAL ||"<<endl;
cout<<endl;
cout<<"In which conversion you want to go ? ";
cin>>ch;
cout<<endl;
switch(ch){
case 1 : binary_to_decimal();
break;
case 2 : binary_to_octal();
break;
case 3 : binary_to_hexadecimal();
break;
default: cout<<"Invalid Input.";
}
break;
}
case 3: {
system("cls");
string phrase ="Opening OCTAL NUMBER CONVERTER CALCULATOR";
cout<<"\n\n\t\t\tLoading...";
string command = "espeak -v m4 \"" +phrase+"\"";
const char* charCommand=command.c_str();
system(charCommand);
system("cls");
int ch;
system("Color 74");
cout<<"\n\n";
cout<<"\t\t\t\t\t ________________________\n";
cout<<"\t\t\t\t\t | OCTAL NUMBER CONVERTER | \t\t\t";
cout<<"\t\t\t\t\t |________________________| ";
cout<<"\n\n\n\n";
cout<<"\t\t || Press 1 for OCTAL TO DECIMAL ||"<<endl;
cout<<"\t\t || Press 2 for OCTAL TO BINARY ||"<<endl;
cout<<"\t\t || Press 3 for OCTAL TO HEXADECIMAL || "<<endl;
cout<<endl;
cout<<"In which conversion you want to go ? ";
cin>>ch;
cout<<endl;
switch(ch){
case 1 : octal_to_decimal();
cout<<endl;
break;
case 2 : octal_to_binary();
cout<<endl;
break;
case 3 :octal_to_hexadecimal();
cout<<endl;
break;
default : cout<<"Invalid Input.";
}
break;
}
case 4: {
system("cls");
string phrase ="Opening HEXADECIMAL NUMBER CONVERTER CALCULATOR";
cout<<"\n\n\t\t\tLoading...";
string command = "espeak -v m1 \"" +phrase+"\"";
const char* charCommand=command.c_str();
system(charCommand);
system("cls");
int ch;
system("Color 8B");
cout<<"\n\n";
cout<<"\t\t\t\t\t ____________________________\n";
cout<<"\t\t\t\t\t |HEXADECIMAL NUMBER CONVERTER| \t\t\t";
cout<<"\t\t\t\t\t |____________________________| ";
cout<<"\n\n\n\n";
cout<<"\t\t || Press 1 for HEXADECIMAL TO DECIMAL || "<<endl;
cout<<"\t\t || Press 2 for HEXADECIMAL TO BINARY ||"<<endl;
cout<<"\t\t || Press 3 for HEXADECIMAL TO OCTAL ||"<<endl;
cout<<endl;
cout<<"In which conversion you want to go ? ";
cin>>ch;
cout<<endl;
switch(ch){
case 1 : hexadecimal_to_decimal();
cout<<endl;
break;
case 2 : hexadecimal_to_binary();
cout<<endl;
break;
case 3 : hexadecimal_to_octal();
cout<<endl;
break;
default : cout<<"Invalid Input.";
}
break;
}
}
}