Hello! i need help with my program. im trying to write a function that takes in 2 binary numbers and subtracts using the carry method. below is what i have so far and it's not outputting anything. i have a feeling that im doing something completely wrong. care to help?
ok so I did both methods but when i use to_string() it says it's undeclared.
lab06.cpp: In function `std::string subtract(std::string, std::string)':
lab06.cpp:19: error: `to_string' was not declared in this scope
lab06.cpp:19: warning: unused variable 'to_string'
*** Error code 1
make: Fatal error: Command failed for target `lab06.o'
and when i use the other method it doesn't out put anything.
IMO, the way you are trying will be difficult for you!
it will be little easier and far more applicable to write two functions, one will convert binary string to decimal int, then you do all kind of operations (add,multiply,subtract,divide,power,log etc) on the ints to get the result, then the other function will convert the int result to binary string.