Question: Change this C++ to MIPS Assembly Language. I Am Using QtSPIM compiler. #include #include using namespace std; // BinaryEquivalent() function to convert the decimal number
Change this C++ to MIPS Assembly Language. I Am Using QtSPIM compiler. #include #include using namespace std; // BinaryEquivalent() function to convert the decimal number into equivalent binary number void BinaryEquivalent(int num) { // array for storing all digits of binary equivalent number int bin[32]; // counter variable int count = 0; // run while loop till num is greater than zero while (num != 0) { // store the remainder in array bin[count] = num % 2; // divide num by 2 num = num / 2; // increment counter variable count++; } // printing array containing all digits of binary number in reverse order for (int i = count - 1; i >= 0; i--) cout << bin[i]; cout<<"\t"; } // OctalEquivalent() function to convert the decimal number into equivalent octal number void OctalEquivalent(int num) { // array for storing all digits of octal equivalent number int octal[32]; // counter variable int count = 0; // run while loop till num is greater than zero while (num != 0) { // store the remainder in array octal[count] = num % 8; // divide num by 8 num = num / 8; // increment counter variable count++; } // printing array containing all digits of octal number in reverse order for (int i = count - 1; i >= 0; i--) cout << octal[i]; cout<<"\t"; } // HexadecimalEquivalent() function to convert the decimal number into equivalent octal number void HexadecimalEquivalent(int num) { // array for storing all digits of Hexadecimal equivalent number char hexadecimal[100]; // counter variable int count = 0; // run while loop till num is greater than zero while (num != 0) { // store the remainder in variable t int t = num % 16; // if t is less than 10 if (t < 10) hexadecimal[count] = t + 48; // if t is greater than or equal to 10 else hexadecimal[count] = t + 55; // increment count count++; // divide num by 16 num = num / 16; } // printing array containing all digits of hexadecimal number in reverse order for (int i = count - 1; i >= 0; i--) cout << hexadecimal[i]; cout<<"\t"; } // Driver Code int main() { int nums[10]; cout<<"Input 10 random numbers between 0 to 255 : "<>num; // if number is negative or greater than 255 while(num < 0 || num > 255) { // then show error message and take its input again and again until user inputs valid number cout<<"Error! Number must be in range [0, 255]. Enter again: "; cin>>num; } } cout< Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
