*Construct a flowchart for Base Conversion Module to illustrate the codes below.*
#include using namespace std;int octal(int deciNum){int octalNum = 0, countval = 1;int dNo = deciNum;while (deciNum != 0) {// decimals remainder is calculatedint remainder = deciNum % 8;// storing the octalvalueoctalNum += remainder * countval;// storing exponential valuecountval = countval * 10;deciNum /= 8;}return octalNum;}string binary(int num){string str;while(num){if(num & 1) // 1str+='1';else // 0str+='0';num>>=1; // Right Shift by 1}return str;}void reverse(string str){for(int i=str.size()-1 ; i>=0 ; i--)cout<>}int main(){int n;char ch;cout<"enter the="" decimal="" number:="">"enter>cin>>n;cout<"enter b="" for="" binary,="" o="" for="" octal:="">"enter>cin>>ch;if(ch=='b'){cout<"binary of="">"binary><><" is="">">reverse(binary(n));}else if(ch=='o')cout<"octal of="">"octal><><" is="">"><>elsecout<"invalid>"invalid>return 0;}
using namespace std;int octal(int deciNum){int octalNum = 0, countval = 1;int dNo = deciNum;while (deciNum != 0) {// decimals remainder is calculatedint remainder = deciNum % 8;// storing the octalvalueoctalNum += remainder * countval;// storing exponential valuecountval = countval * 10;deciNum /= 8;}return octalNum;}string binary(int num){string str;while(num){if(num & 1) // 1str+='1';else // 0str+='0';num>>=1; // Right Shift by 1}return str;}void reverse(string str){for(int i=str.size()-1 ; i>=0 ; i--)cout<>}int main(){int n;char ch;cout<"enter the="" decimal="" number:="">"enter>cin>>n;cout<"enter b="" for="" binary,="" o="" for="" octal:="">"enter>cin>>ch;if(ch=='b'){cout<"binary of="">"binary><><" is="">">reverse(binary(n));}else if(ch=='o')cout<"octal of="">"octal><><" is="">"><>elsecout<"invalid>"invalid>
return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here