Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions