ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 06 Jun 2017 My Price 9.00

translating a C program into a MIPS

Attached is a document that has 2 questions. Both deal with translating a C program into a MIPS assembly program. Please follow the instructions outlined in the document.

 

Question 1The following C program asks the user for two input null-terminated strings, eachstored in uninitialized 100-byte buffer, and compares them. The program thenshows the alphabetical order of both strings, by reporting whether the first is lessthan the second, the second is less than the first, or both are equal.#include <stdio.h>int main(){ // Two strings, 100 bytes allocated for each char s1[100]; char s2[100]; // Read string 1 printf("Enter string 1: "); scanf("%s", s1); // Read string 2 printf("Enter string 2: "); scanf("%s", s2); // Compare them int index = 0; while (1) { // Load characters from s1 and s2 char c1 = s1[index]; char c2 = s2[index]; // Current character is greater for s1 if (c1 > c2) { printf("s1 > s2\n"); break; } // Current character is greater for s2 if (c1 < c2) { printf("s1 < s2\n"); break; }  // End of strings reached if (c1 == 0) { printf("The strings are equal\n"); break; } // Compare next character index++; }

Attachments:

Answers

(11)
Status NEW Posted 06 Jun 2017 03:06 AM My Price 9.00

-----------

Not Rated(0)