kvnsdr
asked on
Large string addition subtraction ?
I have two very long strings (150-250 digits) I need to perform math addition subtraction.
string a = "1111111111111111111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 11111111";
string b = "2222222222222222222222222 2222222222 2222222222 2222222222 2222222222 2222222222 2222222222 2222222222 2222222222 2222222222 22222222";
string c = "33333333333333333333";
string Finished = a - b + c;
These are the longest/largest numbers I've ever worked with, so I don't know if I should covert them before processing math.
I recieve this compile error: Operator '-' cannot be applied to operands of type 'string' and 'string'
string a = "1111111111111111111111111
string b = "2222222222222222222222222
string c = "33333333333333333333";
string Finished = a - b + c;
These are the longest/largest numbers I've ever worked with, so I don't know if I should covert them before processing math.
I recieve this compile error: Operator '-' cannot be applied to operands of type 'string' and 'string'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
with
string b = "2222222222222222222222222
string c = "33333333333333333333";
b+c = "2222222222222222222222222
not
"2222222222222222222222222
I do not know of any 'native' C# workspaces that can deal with 150 -250 digit INTEGERS. What are you doing that requires the use of such large numbers?
AW