Concepts decision and looping

Premiado Postado Apr 12, 2014 Pago na entrega
Premiado Pago na entrega

CDA 3101 - Concepts

Assignment ID: MIPS4

REQUIRED: mandatory: B, D; Optional: A, C, E.

SUBMISSION: Submit the .s, .log files.

--------------------------------------------------------

=====================================================================

A. (smaller) Write a MIPS program to display the smaller of two input values.

=====================================================================

Follow the pseudo-code below.

cin >> A >> B;

if (A < B)

cout << "FIRST=" << A << endl;

else

cout << "SECOND=" << B << endl;

Print B

======================================================

TEST CASES: { 2 14 } {1 1 } {144 -22} {2 2 2 }

Submit: CSsubmit MIPS4 smaller.s [url removed, login to view]

--------------------------------------------------------

B. (add2or3) Develop MIPS programs that perform simple decision making.

======================================================

TEST CASES: { 2 14 18 } {1 } {3 8 144 -22} {2 -22 21} {3 0 0 0 }

Implement this pseudo-code.

cin >> k;

if (k == 2)

{

cin >> a >> b; sum = a + b; cout << k << sum;

}

else if (k == 3)

{

cin >> a >> b >> c; sum = a + b + c; cout << k << sum;

}

else

cout << 9999;

Submit: CSsubmit MIPS4 add2or3.s [url removed, login to view]

--------------------------------------------------------

C. (decisions) Develop MIPS programs that perform simple decision making.

======================================================

TEST CASES: {47, -15} {-12487,-782821} {4328, 4328} {5326,6235}

======================================================

cout << "Enter Number X: "; cin >> X;

cout << "Enter Number Y: "; cin >> Y;

if (X > Y)

cout << X << " GREATER THAN " << Y << endl;

if (X <= Y)

cout << X << " LESS THAN OR EQUAL TO " << Y << endl;

if (X == Y)

cout << X << " EQUALS " << Y << endl;

--------------------------------------------------------

D. (countloop) Develop a MIPS programs that performs simple looping.

int upLimit, downStart;

cout << "Count-up LIMIT: "; cin >> upLimit;

cout << endl << "COUNT UP: ";

for (K=1; K<= upLimit; K++)

cout << K << " ";

cout << " END_up" << endl;

cout << "Count-down START: "; cin >> downStart;

cout << "COUNT DOWN: ";

for (M=downStart; M >= 1; M--)

cout << M << " ";

cout << " END_down" << endl;

======================================================

TEST CASES: { 5 8 } {0 4 } {7 0 } { 0 0 } { 3 3 }

--------------------------------------------------------

E. (findmax) Develop a MIPS program that computes the MAX of 7 inputs.

cout << "Enter Number: "; cin >> Num;

Max = Num;

for (k = 2; k <= 7; k++)

{

if ( Num > Max)

Max = Num

cout << "Enter Number: "; cin >> Num;

}

cout << "MAX = " << Max

========================================================

TEST CASES: {10,1,2,3,4,5,7} {0,1,-8,-12,5,2,80} {8,13,1,15,14,0,2}

{1,2,3,4,5,6,7} {98,87,76,65,54,43,32} {0,3,6,9,7,4,2}

========================================================

PHP Arquitetura de software

ID do Projeto: #5797999

Sobre o projeto

1 proposta Projeto remoto Ativo em Apr 14, 2014

1 freelancer está oferecendo em média $77 para esse trabalho

nauman187

hi, i can help you with this and deliver the solution today. i have a lot of experience with mips. please reply to discuss more. thanks.

$77 USD in 0 dias
(6 Comentários)
3.4