Question
I want to convert C++ code to MIPS 32-bit assembly language, here is the code include #include using namespace std; int main() { int no
I want to convert C++ code to MIPS 32-bit assembly language, here is the code
include
int main() { int no = 0, size = 10; int storeno[10]; for (int i = 0; i < size; i++) { cout << "Please Enter Number " << i + 1 << " (0-255) : "; cin >> no; while (no < 0 || no > 255) { cout << "Invalid Number. Please Re-enter Your Number Again (0-255) : "; cin >> no; } storeno[i] = no; }
cout << endl << endl;
//array display decimal int storeBinary[10]; int j; for (int i = 0; i < size; i++) { int n = storeno[i]; for (j = 0; n > 0; j++)
{ storeBinary[j] = n % 2; n = n / 2; } cout << "Binary for " << storeno[i] << " : "; for (j = j - 1; j >= 0; j--) { cout << storeBinary[j]; } cout << endl; }
cout << endl << endl;
//array display decimal to octal int octalNumber[10]; for (int i = 0; i < size; i++) { int n = storeno[i]; for (j = 0; n > 0; j++) { octalNumber[j] = n % 8; n = n / 8; } cout << "Octal for " << storeno[i] << " : "; for (j = j - 1; j >= 0; j--) { cout << octalNumber[j]; } cout << endl;
} //array display decimal to hexadecimal cout << endl << endl; char hexadecimalNumber[10]; int temp = 0; for (int i = 0; i < size; i++) { int n = storeno[i]; for (j = 0; n > 0; j++) { temp = n % 16;
if (temp < 10) { hexadecimalNumber[j] = temp + 48; } else { hexadecimalNumber[j] = temp + 55; } n = n / 16; } cout << "Hexadecimal for " << storeno[i] << " : "; for (j = j - 1; j >= 0; j--) { cout << hexadecimalNumber[j]; } cout << endl; }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started