Question: Please help me convert the C++ code below to MIPS 32-bit assembly language, tq. include #include using namespace std; int main() { int no =

Please help me convert the C++ code below to MIPS 32-bit assembly language, tq.

include #include using namespace std;

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!