I am trying to create a class to manipulate binary number including +, -, & * functions. here is what i already have.
i don't quite know what the operator functions should be. If anyone could help, PLEASE!!!!Code:#include <iomanip.h> #include <stdio.h> #include <iostream.h> #include <stdlib.h> class bin_num{ char data[8]; int todec(bin_num x); bin_num tobin(int x); bin_num operator +(bum_num x); bin_num operator -(bum_num x); bin_num operator *(bum_num x);} bin_num::int todec(bin_num x){ int y; y = strtol(x, NULL, 2); return y; } bin_num::bin_num tobin(int x){ char bnum[8]; itoa(x, bnum, 2); return bnum; } bin_num::bin_num operator +(bum_num x){ } bin_num::bin_num operator -(bum_num x){ } bin_num::bin_num operator *(bum_num x){ }




Reply With Quote