forked from chenzhuowansui/big_num_cal
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (36 loc) · 787 Bytes
/
Copy pathmain.cpp
File metadata and controls
42 lines (36 loc) · 787 Bytes
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
#include <iostream>
#include <string>
#include "big_data_int.h"
int main()
{
cout<<"please input two numbers:"<<endl;
string s_a, s_b;
cin>>s_a;
cin>>s_b;
cout<<"Please input the operator(+,-,*,/,%):"<<endl;
string op;
cin>>op;
big_data_int a(s_a), b(s_b), c;
switch (op.c_str()[0]) {
case '+':
c = a + b;
break;
case '-':
c = a - b;
break;
case '*':
c = a * b;
break;
case '/':
c = a / b;
break;
case '%':
c = a % b;
break;
default:
cout<<"Wrong operator input"<<endl;
return -1;
}
cout <<"Result is:"<<endl<<c.data()<<endl;
return 0;
}