Question: I need help converting this C++ program to MIPS instructions. Something basic that works with QtSpim to run: #include using namespace std; int antelope(int cc,

I need help converting this C++ program to MIPS instructions. Something basic that works with QtSpim to run:

#include

using namespace std;

int antelope(int cc, int ff);

int swan (int cc);

int main() {

int seed, pin, password;

cout << "Welcome to MIDN Smith's Password Generator!" << endl;

cout << "Enter seed value (in range 0..10): ";

cin >> seed;

cout << "Enter PIN value (in range 0..10): ";

cin >> pin;

if(seed <= 10 && pin <= 10) {

password = antelope(seed, pin);

cout << "Your password: " << password << endl;

}

else {

cout << "Seed or pin error!" << endl;

}

return 0;

}

int swan (int cc) {

if (cc > 5) {

return cc + (swan(cc - 1) * 4);

}

else if (cc > 3) {

return swan(cc - 2) + (4 * cc);

}

else {

return (cc - 1) * 4;

}

}

int antelope (int cc, int ff) {

if (cc <= 5) {

return 8 + swan(ff);

}

else if (cc <= 7) {

return cc + antelope(cc-1,ff+2);

}

else {

return 3 + antelope(cc-1, ff) + 2 * antelope(cc-2, ff-1);

}

}

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!