Hi, Need some help with MIPS

I need to write a MIPS code that reads 10 characters string and then only print out value of 3rd, 5th and 7th character (remembering that first character is character 0)

OUTPUT (should be somewhat like this):

Enter 10 character string : i love you
The 3rd character : l
The 5th character : v
The 7th character :

I'm relatively new to this MIPS and need some help. Would greatly appreciate it!

Well, to start, setup a space for your string for 11 bytes(trailing zero) and put that in your data section.
Also, put your string prompts into the .data section. (i.e. "Enter 10 character string: ")
Then, in your main program, you print the prompting string (you know how to use syscall, right?)
Point the $A0 at the input string buffer.
Use the syscall for reading an input string.

Repeat this block for characters 2, 4, 6
Print out the first output text ("The 3rd character: ")
Load an immediate 2 (being the 3rd number) into a temporary register like $t0.
Use a load byte for $a0 from your input string offset by that register.
Use the print byte syscall.
Repeat (or just copy/paste)

And syscall to exit.
Happy coding!

EDIT: For sanity's sake, start your "The 3rd character: " with New Lines (i.e. "backslash n"). That way, when you print you character, and then the next string, it won't be jammed together.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.