Reference no: EM132101186
Please write MIPS program that runs in QtSpim (ex: MipsFile.s)
Write a MIPS program that will read in a base (as an integer) and a value (nonnegative integer but as an ASCII string) in that base and print out the decimal value; you must implement a function (which accepts a base and an address for a string as parameters, and returns the value) and call the function from the main program.
The base will be given in decimal and will be between 2 and 36, and the digits for the values will be in set [0...9, a...z]. You can assume that no overflow will occur and the value is valid in the given base.
An example run will be:
Enter a base (between 2 and 36 in decimal): 2
Enter a number in base 2: 101
The value in decimal is: 5
The program needs to be able to test 3 different cases and run in QtSpim like a .s file
here is a c program that shows the functionality
#include <ctype.h> #include <stdio.h> #include <string.h> int convert2dec(char *str, int base) { int j, val; val = 0; j = 0; while (str[j] > 13) { if (str[j] > 57) val = val * base + str[j]-87; else val = val * base + str[j] - 48; j++; } return val; } int main(int argc, char *argv[]) { int X; char str[256]; printf("Please the base (in decimal): "); scanf("%d", &X); printf("Please enter a nonnegative number: "); scanf("%s", str); printf("The decimal value is %d.\n", convert2dec(str,X)); return 0; }
Define and integer variable named employeescount
: Defines a structure called Employee that contains a character member called id that can hold an id that is up to 9 characters long and a float member.
|
Create a class with the name student
: Create a constructor that initializes all int to 0, float to 0.0, char to ' ', name = "NoName".
|
Show total distance traveled and total gas consumed
: Allow the user to keep entering data in 5 minute increments until the user has no more data to enter. Show total distance traveled, total gas consumed.
|
Create a class line which consists of start -end coordinates
: Create a class Line which consists of start and end coordinates, and line type.The default value for line type should be vertical.
|
Write a mips program that will read in a base
: Write a MIPS program that will read in a base (as an integer) and a value (nonnegative integer but as an ASCII string) in that base.
|
Give the state of the array after it is max heapified
: Give the state of the array after 3 "removes" (we are not really deleting anything) have been performed from the heap in phase 2 of heapsort.
|
Write a program to ask for the chord
: With one cut across the middle of a pizza you can cut off half, that is, 50% of the pizza. With one cut at a different place you can cut off.
|
Using recursion determine if the string is a palindrome
: Using recursion, count how many times each of the letter "a" and "k" are repeated (There may be 0 a and 0 k in the string).
|
Deterinine the average codeword length
: Determine the average information for this message. (You may ignore hyphens, spaces, and punctuation.)
|