Answer to Question #241877 in C++ for Zia

Question #241877

Attaching a link below which contain question for C++ kindly answer this as soon as possible shall be thankful.


https://drive.google.com/file/d/1ag_lt9tUtEiDE910HhaNaDHpT89eWM6L/view?usp=sharing

1
Expert's answer
2021-09-25T05:57:22-0400

Problem 1 solution

char SYS_PRINT_WORD = "a";


float SYS_PRINT_FLOAT = "1.5";
double SYS_PRINT_DOUBLE = "222222222";
char SYS_PRINT_TEXT = "b";
input SYS_INPUT_WORD = "  ";


string result = " ";


int x = 0;
result: "0123456789012345" ;
x = $s5;
tx_prompt = "Please enter a value for x (integer): ";
tx_bbb = "bbb";
tx_ccc = "ccc";


tx_ddd =  "ddd";
tx_eee = "eee";
prob1_label = 1;
prob2_label = 2;
prob3_label = 3;
prob4_label = 4;


la $a0, tx_prompt 
li $v0, SYS_PRINT_TEXT
syscall 
li $v0, SYS_INPUT_WORD
syscall 
add $s5, $v0, $zero 
la $t0, x
sw $s5, 0($t0) 
la $s4, result 


eee1:
   move $a0, $s4 
   la $a1, tx_eee
   jal concatstr
   j prt1


ddd1:
   move $a0, $s4 
   la $a1, tx_ddd 
   jal concatstr


prt1:
   la $a0, prob1_label
   li $v0, SYS_PRINT_TEXT
   syscall


   move $a0, $s4
   li $v0, SYS_PRINT_TEXT
   syscall


   la $a0, endl
   li $v0, SYS_PRINT_TEXT
   syscall
exit:
li $v0, SYS_EXIT
syscall
 
concatstr:
findend:
lbu $t0, 0($a0)
beq $t0, $zero, docopy 
addiu $a0, $a0, 1
j findend
docopy:
lbu $t0, 0($a1) 
sb $t0, 0($a0)
beq $t0, $zero, concatstr_exit 
addiu $a0, $a0, 1 
addiu $a1, $a1, 1 
j docopy
concatstr_exit:
jr $ra

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS