-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSCOS.cpp
More file actions
426 lines (301 loc) · 6.92 KB
/
SCOS.cpp
File metadata and controls
426 lines (301 loc) · 6.92 KB
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
#include <iostream>
using namespace std;
/*
prog: SCOS
by: Gio Rescigno (clone computers)
repo: LAB progaming
V: 2.7.8
*/
int add() {
long x;
long y;
long sum;
cout<<"addition"<<endl;
cin >> x;
cout <<"+";
cin >> y;
sum = (x + y);
cout << x <<" + "<< y <<" = "<< sum <<endl;
return 0;
}
int subtract() {
long x;
long y;
long sum;
cout<<"subtraction"<<endl;
cin >> x;
cout <<"-";
cin >> y;
sum = (x - y);
cout << x <<" - "<< y <<" = "<< sum <<endl;
return 0;
}
int mul() {
long x;
long y;
long sum;
cout<<"Multiplication"<<endl;
cin >> x;
cout <<"*";
cin >> y;
sum = (x * y);
cout << x <<" * "<< y <<" = "<< sum <<endl;
return 0;
}
int dev(){
long x;
long y;
long sum;
cout<<"division"<<endl;
cin >> x;
cout <<"/";
cin >> y;
sum = (x / y);
cout << x <<" / "<< y <<" = "<< sum <<endl;
return 0;
}
int exp(){
string eop; //to make shue that this is set to nothing
eop = " ";
cout<< "-------------------------------------------------"<<endl;
while(eop != "exit"){
cout << ">: ";
cin >> eop;
if (eop == "help"){
cout<<"exp2"<<endl;
cout<<"exp"<<endl;
cout<<"exit"<<endl;
;
}
else if(eop == "exp2"){
long in;
long out;
int i;
cout <<"Exponents"<<endl;
cout<<"squared: ";
cin >> in;
i = 1;
while(i < 2){
i++;
out = (in * in);
}
cout<< in << "^2 = " << out <<endl;
}
else if(eop == "exp"){
long x;
long y;
long ys;
long xs;
cout <<"Exponents"<<endl;
cin >> x;
cout << "power of: ";
cin >> y;
xs = x;
ys = y;
while (y > 1){
y--;
x = (x * xs);
}
cout << xs << "^" << ys << " = " << x <<endl;
}
else if(eop == "exit"){
return 0;
}
}
}
int pro() {
long a;
long b;
long out;
cout<< "percentage" <<endl;
cout <<"type in the whole: "; //take in the whole
cin >> b;
cout <<"type in the part: "; //take in the part
cin >> a;
a = (a * 100); //the part is muiltpluied by 100
out = (a / b); //part is / by the whole
cout << "%" << out << endl; //the awnser is printed
return 0;
}
int func() {
string fop;
fop = " ";
cout << "-------------------------------------------------" <<endl;
while(fop != "exit"){
cout << ">:";
cin >> fop;
if(fop == "y=") {
int x1;
int x2;
int y1;
int y2;
cout<< "cwardnit 1" <<endl;
cout<< "x: ";
cin >> x1;
cout << "y: ";
cin >> y1;
cout<< "cwardnit 2" <<endl;
cout<< "x: ";
cin >> x2;
cout << "y: ";
cin >> y2;
int m;
int x;
int y;
x = (x1 - x2);
y = (y1 - y2);
m = (y / x);
int b;
b = (y1 - (m * x1));
if (y / x == 0 && y / x < 0){
cout << "y = " << m << "x + " << b <<endl;
}
else {
cout <<"y = (" << y << "/" << x << ")x + " << b <<endl;
}
continue;
}
else if(fop == "cor"){
int m;
int b;
cout << "m = ";
cin >> m;
cout << "b = ";
cin >> b;
cout << "y = " << m << "x + " << b <<endl;
int y1;
int y2;
y1 = (b + m);
y2 = (b - m);
cout << "(1, " << y1 << ") (0, " << b << ") (-1, " << y2 << ")" <<endl;
}
else if(fop == "int"){
long d;
long b;
long m;
long a;
long x;
long y;
cout << "line 1 (y = Mx + B)" <<endl;
cout << "M = ";
cin >> m;
cout << "B = ";
cin >> b;
cout << " "<<endl;
cout << "lone 2 (y = Ax + D)" <<endl;
cout << "A = ";
cin >> a;
cout << "D = ";
cin >> d;
x = ((d - b) / (m - a));
y = ((m * x) + b);
cout << "you lines intersect at";
cout << " (" << x << ", " << y << ")" <<endl;
}
else if(fop == "help"){
cout << "y=" <<endl;
cout << "cor" <<endl;
cout << "int" <<endl;
continue;
}
}
return 0;
}
int geo(){
string gop;
cout << "-------------------------------------------------"<<endl;
cout << "if you need help type 'help' " <<endl;
while(gop != "exit"){
cout << ">:";
cin >> gop;
if (gop == "help"){
cout<<"squ"<<endl;
cout<<"tri"<<endl;
}
else if (gop == "squ"){
cout<<"square"<<endl<<endl;
float bace;
float higeth;
float area;
cout<<"type in bace: ";
cin >> bace;
cout<<"type in higeth: ";
cin >> higeth;
area = bace * higeth;
cout << "area = " << area <<endl;
}
else if (gop == "tri"){
float bace;
float higeth;
float area;
cout<< "triangle"<<endl<<endl;
cout<<"type in bace: ";
cin >> bace;
cout<<"type in higeth: ";
cin >> higeth;
area = bace * higeth / 2;
cout << "area = " << area <<endl;
}
}
}
int main() {
string op = "";
cout<<"welcome to SCOS"<<endl; //the introduction
cout<<"type 'help' it you need help"<<endl; //prompts the user to type help if they dont know the commands ro run this prog
cout << "-------------------------------------------------"<<endl;
while(op != "exit") {
cout<<">:";
cin >> op;
if (op == "help"){ //when you type "help" you can see all the commands that you can use
cout<<"add"<<endl;
cout<<"sub"<<endl;
cout<<"dev"<<endl;
cout<<"mul"<<endl;
cout<<"pro"<<endl;
cout<<"exp"<<endl;
cout<<"func"<<endl;
cout<<"exit"<<endl;//i know some one some day will tell me this help menu does not help any one at all :)
continue;
}
else if(op == "add"){//addition
add();
continue; //not necessary but nice, same for all the other "continues"
}
else if(op == "sub"){//subtraction
subtract();
continue;
}
else if(op == "mul"){//Multiplication
mul();
continue;
}
else if(op == "dev"){//division
dev();
continue;
}
else if(op == "exp"){//expnets
dev();
continue;
}
else if (op == "pro"){//dose porcentages
pro();
continue;
}
else if(op == "func"){//dose all kinds of fun stuff with lines with the equation y=mx+b soon there will be other shapes
func();
continue;
}
else if(op == "geo"){
geo();
continue;
}
else if(op == "ping"){
cout << "Pong!!!!"<<endl;//just for fun!!!!
continue;
}
}
/* my email is clonecomputers1@gmail.com feel free to email me if this program if there is a problem
or if you want to talk to me i much enjoy meeting new people
*/
return 0;
}